Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What package within Headless UI are you using?
For example: @headlessui/react
What version of that package are you using?
For example: v1.7.15
What browser are you using?
For example: Chrome, Safari, Polypane
Reproduction URL
https://codesandbox.io/p/sandbox/sharp-sound-53snkd?file=/src/App.jsx:8,70
Describe your issue
When using
<Transition as={Dialog} unmount={false} />
, the unmount does not behave correctly. Firstly, it does not appear on the page at all, when show is set totrue
. Secondly, the DOM elements of the Panel are not present.When using on the other hand:
... it does work and animates as expected.
Narrowing it down further. If
<Transition as="div" unmount={false} />
is used instead (noticeas
being adiv
, over aDialog
), it works as expected. If you also useunmount={true}
, it works as expected as well. regardless of the value ofas
.It appears that the combination of
<Transition as={Dialog} unmount={false} />
specifically, causes strange behavior.Real life use case
I am building a Navigation menu in the form of a Dialog, which needs to
unmount={false}
for SEO purposes as even the desktop menu uses this Dialog. In my use-case, I need focus-trapping. This Dialog appears as a drawer, sliding in from the side, with swiping gestures for dismissal.I could naturally use Popover here; but then I would not get the same focus management.
See my CodeSandbox above for a relatively clean example of this strange behavior in-action.
Beta Was this translation helpful? Give feedback.
All reactions