Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using unmount={false} on Transition inside Menu make Transition unappear #2365

Closed
MKlblangenois opened this issue Mar 15, 2023 · 2 comments
Closed
Assignees

Comments

@MKlblangenois
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

For example: v1.7.13

What browser are you using?

For example: Brave / Firefox / Safari

Reproduction URL

Stackblitz reproduction : https://stackblitz.com/edit/react-ts-fsfrop?file=App.tsx

Describe your issue

When I'm using <Transition unmount={false} /> inside <Menu>, the transition element will never appear, even in DOM.

@thecrypticace thecrypticace self-assigned this Mar 15, 2023
@b3nk3
Copy link

b3nk3 commented Mar 16, 2023

I came across something similar - you need to add unmount={false} to <Menu.Items ...props /> on line 33 too, not just the transition.

@thecrypticace
Copy link
Contributor

Hey! So the unmount property in any of your components applies to behavior of the component itself.

For a Transition, unmount={false} only makes sense by itself when as is NOT Fragment because there's a element in the DOM—specific to Transition—that can be controlled. In this case you are going to want to put unmount={false} on both the Transition and Menu.Items as @b3nk3 pointed out. The reason is that <Transition unmount={false}> says "render my children no matter what" to just the <Transition> component. While <Menu.Items unmount={false}> says "render the ul for my menu no matter what" and these are independent decisions which is why you want both.

Hope that helps! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants