Dialog: Add legacy z-index compatibility#75874
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 6.84 MB ℹ️ View Unchanged
|
|
By the way, currently it's difficult (impossible?) to override the z-indexes for YAGNI for now, but at some point we may need to tweak something, like have |
|
Could we:
Or even be set on the root and passed to both popup and backdrop via context? |
What?
Adds a
--wp-ui-dialog-z-indexCSS custom property to the Dialog component's backdrop and popup, following the same pattern used by other@wordpress/uicomponents (Combobox, Select, Tooltip).Why?
Gutenberg manages stacking with explicit z-index values. Without this, the Dialog has no z-index hook, making it impossible for consumers to ensure correct stacking when the Dialog coexists with legacy
@wordpress/componentspopovers or modals.The CSS variable defaults to
initial(no z-index), so there's no behavioral change unless a consumer explicitly sets the variable — e.g., via a global compatibility layer that maps it to the legacy.components-modal__screen-overlayz-index.How?
z-index: var(--wp-ui-dialog-z-index, initial)to both.backdropand.popupinstyle.module.css. Both need the z-index because they're siblings inside the portal (unlike the legacy Modal where the frame is a child of the overlay).Testing Instructions
No visual changes.