Raise z-index of content div relative to sidebars#38893
Raise z-index of content div relative to sidebars#38893draganescu merged 1 commit intoWordPress:trunkfrom
Conversation
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @ironprogrammer! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Thanks for checking this out and providing some additional test feedback, @jasmussen!
That brings up a test scenario where it might be interpreted that this fix allows the modal to appear too high on the z-axis. For example:
As mentioned in the PR description, from a UX perspective, a modal should be on top of everything else. If this popover was adjusted to flow "under" the top header, then it may not conform to this expectation. Further ThoughtsIf consensus goes the other way on this detail, then IMHO, the actions sidebar (re: Publish button vis in #32869) might be better positioned as a sibling to the editor's header, body, and footer, rather than as a descendant of the body, as it is today. If actions should always appear on top of everything else, then it would make sense to reflect that in the DOM for better readability and easier z-axis control. Once the actions were no longer "under" the top header, then the static pinning of the content div's |
|
Excellent context, thank you.
Do you have any additional context for this one? I'd like to learn, because from my experience that's not necessarily a requirement for proper modal behavior, and it would also be a principle that would have consequences for many other modal interfaces in the editor, such as the block inserter, or even dropdown menus from the block toolbar. Which incidentally led me to discover this bug we have at the moment 🙈 : My instinct would be that any dialog that is invoked from the editing canvas is on top of anything inside that editing canvas. But that you can still have a top toolbar that is elevated above the entire editing canvas and its contents. |
|
In response to @jasmussen:
Thanks for this. It makes me reconsider the initial approach. Looking more closely at the popovers that are NOT obscured by the sidebars -- e.g. block inserter, text alignment, block settings menu -- these remain visible because they are injected into a dedicated From what I have been able to gather, the link popover is the only one that is nested inside the editor, as opposed to being pushed to the external 💡 Perhaps relocating the link popover's injection point would be a better fix to this issue, making it consistent with the other popovers. Thoughts? Considerations
|
Thanks, @jasmussen! If this were targeted to 12.7.1, would it get additional test love? |
It seems like this bugfix could land at any time, so I guess it just needs an additional dev to take a look and sanity check it! 👌 |
|
@ironprogrammer are there any other modals or full page overlays at all that this could potentially interfere with? If not, I think we're good to go – I think this UI element should be above pretty much anything other than a full-page overlay and things like navbars that conceptually live on the "glass pane" in front of everything else, and it seems like you already took care of the latter. |
|
In response to @adamziel:
My own (and @jasmussen's) testing involved one or both sidebars, setting the browser width narrow enough that the content area was too small for the width of the popover, activating the popover while scrolling the editor up/down, and checking on mobile (responsive below medium). It has been noted that this new |
Thanks, @talldan! Yes, I think the solution for that would be to give first class modalization to the popover, mentioned here. A popover is a modal, and modals are designed to focus the user's attention on a specific task, and the control's surface should be completely visible/usable for completing the task. I feel that the PR in its current state, which only affects a z-axis change within the editor itself, still serves a purpose. It would:
|
draganescu
left a comment
There was a problem hiding this comment.
I think this should land, it solves the problem in the description. The wp-admin sidebar is afaik an old source of z-index problems, and considering the editors default to full screen it is a lower priority problem.
|
This change affects the templates page, which uses the A proposed workaround over here: #39331 Cheers! |
|
So we're stuck with this forever? 😢 |
|
@draganescu -- No, we shouldn't be. Maybe I'm old school, but IMHO a modal should never be under other UI elements -- it defeats the intent of "User, look at this and complete this task before doing anything else" (even if the modal is simply dismissed). Many other popovers are filled outside of the editor's control surfaces (i.e. outside of the editor skeleton, as referenced here). What are your thoughts about shifting the fill location for the link popover so that it follows those examples? |









Description
Adjusts the pinned
z-indexofinterface-interface-skeleton__contentso that it has a value relative to its sibling elements:interface-interface-skeleton__sidebarinterface-interface-skeleton__secondary-sidebarwhich are set to
z-index: 90at medium screens and up.This change allows popover modals triggered in the block editor content area to appear at a higher z-axis than the sidebars,
z-index: 91. From a UX perspective, a modal should be easily accessible and visible given screen size constraints.Addresses #38723 (and
#38957).History
Issue #32631 was raised due to a display quirk in iOS Safari, whereby a static
z-indexwas applied tointerface-interface-skeleton__body(the editor's "body" element) via #32732.In that PR, the editor's "header" (
.interface-interface-skeleton__header) hadz-index: 30. Logically, setting the body to a lower index would stack it underneath the header, so it was assignedz-index: 20.During testing, it was found that pinning the editor's body
z-indexcaused the buttons at the top of.interface-interface-skeleton__actionsto be hidden, preventing access to the Publish button for new posts. In response, the pin was moved lower in the DOM to the body's "content" div,.interface-interface-skeleton__content, updated in #32869.The result was that the content div was now pinned, but had sibling elements with a preexisting
z-indexof a higher value. Since the sidebars were set toz-index: 90, the lower value of20-- originally meant for the body div -- would mean the content section would always appear "under" the sidebars. This introduced the issue addressed in this PR.Testing Instructions
Apply the patch to Gutenberg and re-build the plugin. Make sure the plugin is activated.
Screenshots
Before Fix
After Fix
Regression for #32869
Actions panel retains priority stacking context (i.e. content appears "under" panel).
Regression for #32732 (tested with Browserstack real device: iPhone 11 Pro)
iOS Safari header bar content remains visible (no bleed from editor content area).
Types of changes
Changes the default
z-indexof.interface-interface-skeleton__content.Checklist:
*.native.jsfiles for terms that need renaming or removal).