Stacking dialogs doesn't work when dialogs come from a different package that both use headlessui #3648
Replies: 2 comments 1 reply
-
The modal component appears to create a layer on top of the page and take away any focus in another popup. It appears to be designed to listen for any click outside of the focused element to close it. I'm looking for a possible solution to a similar problem. |
Beta Was this translation helpful? Give feedback.
-
Hey! This should work if the package is deduped because we do rely on some contexts internally which should have the same reference. I also notice that you are using In either case, if you could setup a minimal reproduction repo for us to clone, that would be helpful. |
Beta Was this translation helpful? Give feedback.
-
Using
In my example I have a package that I am working on that displays headlessui dialogs. When I try to use this package (e.g. in example app) in the app that uses headlessui on it's own, then closing the inner dialog (from the package) by clicking out closes the outer dialog (from the example app). When I have exactly the same code but just in one package everything works as expected.
The example code:
When I try to click out to close the inner modal, it closes the outer modal.
Interestingly when I replace outers modal setOpen with an empty function, then even the inner modal doesn't close when I click out. As if the outer modal swallows the click event and doesn't bubble it to the inner modal.
Is there something I am doing wrong in here? How could I make it work?
Beta Was this translation helpful? Give feedback.
All reactions