themes icon indicating copy to clipboard operation
themes copied to clipboard

Ensure loading button with `asChild` renders the correct element

Open chaance opened this issue 5 months ago • 1 comments

Description

Using asChild with the button component in the loading state is currently broken. Because we wrap the child (assuming the child represents the inner contents of the button rather than the button element itself), Radix Slot is unable to resolve the slottable component since it is not a direct child of the slottable component. The result is that the button does not render a wrapping DOM element, and the loading spinner ends up positioned relative to nearest relative container.

This PR solves the problem by extracting the nested element's children, wrapping them, passing that into a clone of the element passed to the children prop.

chaance avatar Sep 04 '25 22:09 chaance

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
themes-playground Error Error Sep 4, 2025 10:36pm

vercel[bot] avatar Sep 04 '25 22:09 vercel[bot]