You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to keep the content of the dropdown menu mounted in the DOM even when its closed by using forceMount, onOpenChange and display: none. Whenever I click on the trigger button, it runs the onOpenChange function twice, toggling it back to its original state.
I'm trying to keep the content of the dropdown menu mounted in the DOM even when its closed by using forceMount
Trying to do this using will result in all sorts of other issues as this is not the intended use for forceMount, and other things like focus trapping and other listeners would still be active if you kept it rendered. forceMount is here for the purpose of JS-based animations.
There could be an argument made for SEO reasons, that's what we are discussing over in #1155, I invite you to read up there.
Bug report
Current Behavior
I'm trying to keep the content of the dropdown menu mounted in the DOM even when its closed by using
forceMount
,onOpenChange
anddisplay: none
. Whenever I click on the trigger button, it runs theonOpenChange
function twice, toggling it back to its original state.Expected behavior
The onOpenChange function only runs once.
Reproducible example
CodeSandbox Link
Suggested solution
Additional context
Your environment
The text was updated successfully, but these errors were encountered: