-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What package within Headless UI are you using?
@headlessui/react v2.2.2
tailwindcss v4.1
What browser are you using?
Chrome, Safari, and Firefox
Reproduction URL
https://codesandbox.io/p/sandbox/github/jacogasp/headless-ui-disclosure-animation
Describe your issue
Hello,
I'm using the Disclosure component to implement a simple drawer with animation provided by tailwindcss v4.
The animation is handled by the data-[closed] attribute, e.g:
<Disclosure defaultOpen>
<DisclosureButton>Open/Close</DisclosureButton>
<DisclosurePanel
as="aside"
transition
className=easy-in-out fixed inset-0 z-20 mt-16 w-80 duration-100 data-[closed]:-translate-x-full"
>
...
</DisclosurePanel>
<Dialog>The problem is that, nevertheless the disclosure should be already open, the animation plays when landing on the page, probably because the component starts with the attribute data-closed reaching the data-open attribute after the initial render.
The expected behavior is that the animation does not play at all until I click the disclosure button to close the drawer.