-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Popovers and other UI should not appear on top of modal dialog overlays #55894
Comments
It is worth mentioning that no other UI should appear on top of a modal dialog overlay so this is not limited to popovers but applies to any other UI that potentially may have the same incorrect behavior. |
This is a fair point, and potentially a tricky one to solve:
|
Thanks @ciampo for your feedback. I think there are two different aspects to consider here:
The current z-index value for popovers is higher than the one for the modal dialog overlay:
|
Trying to inspect all the z-indexes with very high value I just noticed that also the new dropdown powered by ariakit uses a too high z-index value. The value is hardcoded in the component. I do realize why but that should be improved as noted in the comments in the code. Screenshot of a dropdown menu appearing on top of a modal dialog overlay: |
One aspect to consider is that popover-based components (eg. dropdown menus, tooltips) can also be rendered inside a modal dialog, and therefore it's not straightforward to come up with z-index rules that work across all scenarios. |
Could these be modified to render within the modals. Doing so would resolve the issue as the popover would be created within the modal's stacking context. |
If they render within the modal in the DOM, overflow issues might happen (with A different approach is to set up a React Context-based z-index stack. This way, nested dialogs can increase the z-index they obtain from the context based on the React tree, even if they're appended to another DOM node using React Portal. |
Worth reminding there was also a problem with tooltips within the modal dialog, in the Site Editor and on mobile. See #47614 (comment) that was fixed only coincidentally with the refactoring of the tooltips with ariakit in #48440 |
Overall, I'd like to reach a point where our popover-based UIs (modal or not) render correctly on top of each other, following the react tree nesting, and thus allowing us to move away from hardcoded For the rare cases where, while some modal UI is rendered on screen, a new piece of non-nested modal UI needs to be rendered (like in the issue's description), we have two choices:
Whatever solution we adopt, we'd likely need something like a global "modal context" to manage the logic. |
One more evident case after #56817 is when creating a new template in the post editor:
Cc @youknowriad Screenshot: |
Description
Splitting this out from #55785
Difficult to say what package this issue is about. It's more about how some components are used in combination with particular user flows.
In all cases, when a modal dialog opens nothing else should visually appear on top of the modal dialog overlay.
This doesn't appear to be the case when a popover is open and then invoking a modal dialog via keyboard shortcuts.
Step-by-step reproduction instructions
Screenshot:
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: