Closed RobinMalfait closed 5 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
headlessui-react | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 24, 2024 2:59pm |
headlessui-vue | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 24, 2024 2:59pm |
This PR improves the default behavior of our
<Fieldset />
component.Initially we used a
div
becausefieldset
/legend
is hard to style otherwise. However, a fieldset on its own is still useful and has some benefits (such as disabling all native form elements if thefieldset
itself is disabled).We still setup an internal
DisabledProvider
such that our own components can read from this state and disable themselves accordingly.This is technically a breaking change, but I doubt that anyone runs into this issue.
If so, you can apply the following diff to fix it:
Note: if you were already using
disabled
on the<Fieldset disabled>
, and you useas="div"
then you won't have the default behavior where it disables these form elements.Implementation looks a bit more complex, but essentially added new functionality to compute what the final
tagName
is of a component and based on this information we know which props to render. If a nativefieldset
is used, we can use thedisabled
prop, if another element is used we can renderaria-disabled
and arole="group"
.The new internal
useResolveTag
will compute the tag name, and it defaults to theprops.as
value.