Tooltips (Popover Components) within modals aren't visible in the Site Editor and on small screens #47614
Labels
CSS Styling
Related to editor and front end styles, CSS-specific issues.
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Edit Site
/packages/edit-site
[Type] Bug
An existing feature does not function as intended
[Type] Regression
Related to a regression in the latest release
z-index
Discussions related to CSS z-index stacking.
Description
Hat tip to @carolinan for discovering this in #47540
The first part of this issue is an actual regression. The second part appears to have always been there.
To better understand the root cause of this issue I'd like to recap a couple points about the CSS stacking context:
The difference is that an element with position
absolute
does need also az-index
other than auto to establish a new stacking context, while an element with positionfixed
establishes a new stacking context regardless whether it has az-index
value.1
Site Editor, desktop view: any tooltip used within any modal is not visible. The tooltip is rendered but it's actually hidden behind the modal. Instead, in the Post Editor the tooltips work fine.
2
Post Editor and Site Editor (and I assume also the Widget editor and the Nav editor), on small screens: same as above, any tooltip within modals is not visible.
The root cause for the first issue
After #44770 the element with CSS class
edit-site
has now a position value of fixed. Previously, it wasabsolute
. This element establishes a new stacking context and:.popover-slot
within the.edit-site
element, with a high z-index value but this has an effect only inside the.edit-site
stacking context..edit-site
element so it belongs to another stacking contex. Whatever the tooltip z-index value is, the Modal is always 'on top' of the tooltip.The root cause for the second issue
On small screens, the element with ID
#wpwrap
takes a position value offixed
. This comes fromcommon.css
in core:See the original changeset at https://core.trac.wordpress.org/changeset/32073
The outcome is similar to the first issue:
#wpwrap
establishes a new stacking context so that the tooltiip z-index value has effect only inside this stacking context. The modal is rendered outside of#wpwrap
and it's always 'on top' of the tooltip.The CSS in core is pretty old and I'm not sure whether this bug always occurred or something maybe changed in Gutenberg.
Step-by-step reproduction instructions
body
element has the CSS classesmobile
andmodal-open
. Important note: themobile
class isn't added when resizing the viewport 'on the fly'. It's only added on page load, when the viewport is already set to a small size before loading the page.Screenshots, screen recording, code snippet
Site Editor Modal close button no visible tooltip:
Post Editor: Modal close button visible tooltip:
Mobile Post Editor: no visible tooltip:
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: