Feedback on closeOnInteractOutside
and why its current implementation might not be the best in real-world apps
#3544
baptisteArno
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
There are two alternative approaches to consider when using the popover within a dialog.
<Popover.Root positioning={{ strategy: "fixed", hideWhenDetached: true }}>
{/* ... */}
</Popover.Root> We'll add this to the docs. |
Beta Was this translation helpful? Give feedback.
2 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.
-
Currently, if adding a portalled element (like a list) in a dialog with
closeOnInteractOutside
set to true, if you end up clicking on this list and the mouse is outside the dialog content, it will close the dialog altogether.I see that maintainers are advising not to use portalled elements in dialogs, but I really feel like this is wrong..
Also what about toast notifications? If you happen to have one and dismiss it, it will close the opened dialog.
So I ended up composing my dialog components like so:
This definitely feels hacky but I could not find any issue with this in a complex app like Typebot.
I close the dialog, only if the Positioner is clicked and stop the click propagation on content click
With this I also needed to set
pointer-events: auto !important;
to the body. So that outside elements like toasts are clickable even if a dialog is opened.All this to say that I am a bit surprised with the current dialog implementation / behavior and that it really does not work for my real app needs. So I am wondering if I misunderstood something.
Beta Was this translation helpful? Give feedback.
All reactions