Draggable: Scope the clone's fallback z-index to non-slot placements#78354
Merged
Conversation
The compat overlay slot already supplies an isolated stacking context, so the clone's legacy `z-index: 1000000000` was leaking into intra-slot ordering — biasing the clone above any other slot residents (e.g. `@wordpress/ui` portals opened mid-drag) for no architectural reason. Tag the clone with an `is-in-compat-slot` modifier when it lands in the slot, and reset its `z-index` from CSS. Fallback placements (non- WP hosts, cross-document drags) keep the legacy value.
Apply the legacy `z-index` only when the clone is NOT in the compat slot, rather than setting it and overriding it inside the slot.
|
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: +89 B (0%) Total Size: 7.97 MB 📦 View Changed
ℹ️ View Unchanged
|
mirka
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Follow up to #78183. Drop the drag clone's legacy
z-indexwhen it lands inside the@wordpress/uicompat overlay slot. Addresses this review comment.Why?
The compat slot already supplies an isolated stacking context. Inside it, the legacy
z-indexonly biases intra-slot ordering — currently pinning the clone above other slot residents (e.g.@wordpress/uiportals from #78095). Letting DOM order decide is the more conservative default.More on the stacking interaction
The compat slot in
@wordpress/uiisposition: fixed; z-index: 1000000003; isolation: isolate. Inside it, any positivez-indexresolves only against siblings inside the slot. The clone's legacyz-index: 1000000000was originally chosen to compete with the page; carrying it into the slot was an opinionated stacking choice we never explicitly made.For the fallback paths (non-WP hosts, cross-document drags) the legacy
z-indexstill applies — those placements have to compete with the rest of the page.How?
Add an
is-in-compat-slotmodifier class on the clone wrapper when (and only when)compatSlotis non-null, and gate the fallbackz-indexrule with:not(.is-in-compat-slot).Why a modifier class rather than a structural CSS selector?
The CSS-only alternative would be
[data-wp-compat-overlay-slot] > .clone { z-index: auto; }. That works, but it couples the override to the slot's DOM relationship; the modifier-class approach keeps the conditional styling intent at the JS call site (where thecompatSlotbranch already lives) and the CSS rule self-contained.Testing Instructions
npm run storybook:dev) → Playground / Debug fixtures / Draggable cross-document fallback → drag inside the iframe; clone still renders with the legacy z-index.@wordpress/uitooltips/portals continue stacking above@wordpress/componentsoverlay hosts.[data-wp-compat-overlay-slot]above other overlays.Use of AI Tools
Cursor + Claude 4.7