- Issue created by @lauriii
- 🇬🇧United Kingdom jessebaker
Adding:
astro-island, astro-slot, astro-static-slot { display:contents; }
breaks both the Overlay and SortableJS meaning you basically can't use XB!
The overlay (for both slots and components) relies on being able to get the
boundingClientRect
of the components and slots it is mirroring but that doesn't work with display:contents as those elements then have no box size. This can possibly be worked around by detecting that CSS and instead basing the overlay size on the combined size of the children of the element.SortableJS must have some internal check for the sortable items' size too because as soon as you add
display: contents
to the sortable items they stop working. - 🇺🇸United States effulgentsia
I think the fix for this is to add a JS file to the
astro.hydration
library that adds an event handler for theastro:only
event that Astro fires after hydration completes, and in this event handler, remove the<astro-slot>
and<astro-island>
wrapper elements (i.e., remove them as wrappers by moving their children up to their parent). This would then match what SSR will do once we add SSR support. This would only be for components that don't depend on client state. Reactive components would still need these wrappers. But so long as this works for non-reactive components, people can solve grid issues by, for example, nesting non-reactive grid container components inside a reactive component that needs a grid.In the meantime, the specific component in the issue summary can be made to work with this trick:
const gridVariants = cva( - "mx-auto grid w-full max-w-[1360px] place-items-center gap-4", + "mx-auto grid w-full max-w-[1360px] place-items-center gap-4 [&>astro-slot]:grid [&>astro-slot]:grid-cols-subgrid", { variants: { cardLayout: { - "2 columns": "grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-2", + "2 columns": "grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-2 [&>astro-slot]:col-span-2",
Hat tip to @lauriii, @larowlan, and @balintbrews for figuring out the above subgrid approach.