-
Notifications
You must be signed in to change notification settings - Fork 1.1k
headlessui / When two modals are opened as brothers(not nested child) #2876
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
Comments
Hey! In order to open multiple dialogs at once, Headless UI requires them to be nested so that it's clear what the hierarchy is and which one should close first when hitting escape for instance. Your example is tricky though because with that content I don't think nesting them really makes sense — one is sort of like an event-driven ad that pops up and might not be related to the dialog behind it. Will leave this open for now just so others on the team have a chance to see it in case they have a suggestion for how to structure this. |
IMO We might need nested modals in some cases when we have global modals like auth etc 🙇🏼 Screen.Recording.2024-01-01.at.11.22.49.PM.mov |
Why is it set like this? |
I had a similar problem where I had two sibling dialogs open. Closing the upper dialog also closed the lower one. In my case, the problem was fixed by changing the way the lower dialog is closed. <Dialog as="div" className="relative z-40" onClose={() => {}} onClick={() => setOpen(false)}> |
For Vue, I had 2 sibling dialogs, and adding
|
I am caught in a similar situation but with Vue and upgrading from 1.7.13 to 1.7.19. I have this setup for some custom prompts (like js prompts where it opens a dialog with different types of input) and some heavy weight item pickers used all throughout the app which shares a single instance. |
This should be fixed by #3242, and will be available in the next release. This PR essentially allows you to render You can already try it using:
|
@RobinMalfait can you confirm this was fixed with the vue version as well and follows the same @insiders tag? |
@aronduby this is currently only a new feature for React, the infrastructure is a bit different for Vue so will require a bit more work to get it implemented there as well. |
@RobinMalfait thanks, is there a separate ticket I should follow for the vue version? |
@RobinMalfait It's working well and very much appreciate your effort! Thank you. |
Is there an issue/discussion that we can follow for Vue implementation of this feature? |
@WoodyDark Any solution for this? |
Is there any solution for vue? |
Maybe a question to ask is: Is there a way to fix it without upgrading to the new version? Sometimes it is complicated to upgrade some libraries in a large project, especially when it comes with breaking changes. |
My recommendation would be to upgrade your library, which is where the fix resides. I didn't experience much pain and it's a large project. If you avoid upgrading libraries in an attempt to buffer yourself from pain or work in the near term, you're potentially setting yourself up for more pain long-term, but that's just based on my experience. Good luck! |
I got your point. Thank you for the advice. Upgrading to the new version is indeed one of our plans, but we are running out of time to deliver other changes. Maybe we should prioritize this one, tho. |
What package within Headless UI are you using?
package: headlessui/react
What version of that package are you using?
version : v1.7.16,
What browser are you using?
Browser : Chrome, Safari , ...
First of all, thanks for this library!. that's so help full
Describe your issue

Multiple/nested Dialog instances bugs #426 I read this issue, but it is not the same as the problem I have.
When two modals are opened as brothers, if we close the second one, the first one behind it will be closed automatically.
These two modals are not nested.
This is how a modal opens. I have a modal to install the application, which is displayed in a time frame. Now if I open another modal and I am doing something and this modal opens, if I close this modal, it is behind it. It also closes.
And there is also a picture below for clearer understanding :
The text was updated successfully, but these errors were encountered: