Draggable: Render the clone inside the overlay legacy slot#77761
Draft
ciampo wants to merge 1 commit intomigrate/snackbar-to-overlay-legacy-slotfrom
Draft
Draggable: Render the clone inside the overlay legacy slot#77761ciampo wants to merge 1 commit intomigrate/snackbar-to-overlay-legacy-slotfrom
ciampo wants to merge 1 commit intomigrate/snackbar-to-overlay-legacy-slotfrom
Conversation
Replace \`ownerDocument.body.appendChild( cloneWrapper )\` with \`getOverlayLegacySlot().appendChild( cloneWrapper )\` for both clone branches (\`__experimentalDragComponent\` and the \`appendToOwnerDocument\` path). The drag clone uses \`position: fixed\` and \`transform\` to follow the cursor, so its positioning is independent of where in the DOM it lives. The \`.components-draggable__clone\` z-index (1,000,000,000 — the billion) is unchanged and now stacks relative to the legacy slot.
|
Size Change: +14 B (0%) Total Size: 7.82 MB 📦 View Changed
ℹ️ View Unchanged
|
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?
Stacked on top of #77760.
Replace
ownerDocument.body.appendChild( cloneWrapper )withgetOverlayLegacySlot().appendChild( cloneWrapper )inDraggable. Both clone branches are covered (__experimentalDragComponentand theappendToOwnerDocumentbranch).Why?
Final step of the legacy-slot migration. With the drag clone in
.wp-overlay-legacy, every legacy@wordpress/componentsoverlay now shares the same stacking context.The drag clone uses
position: fixedandtransformto follow the cursor, so its positioning is independent of where in the DOM it lives. The.components-draggable__clonez-index (1,000,000,000 — the billion) is unchanged; it now stacks relative to the legacy slot. A future cleanup PR can revisit whether the billion is still needed once the slot architecture is fully in place.How?
packages/components/src/draggable/index.tsx:getOverlayLegacySlot.dragComponent-defined branch, one in theappendToOwnerDocument === truebranch) becomegetOverlayLegacySlot().appendChild( cloneWrapper ).appendToOwnerDocument === falsebranch (default) is unchanged — it still appends the clone next to the source element's wrapper.event.dataTransfer.setDragImageand immediately removed) and the body class for cursor styling stay onownerDocument.body.The cleanup path (
cloneWrapper.parentNode.removeChild( cloneWrapper )) is unchanged and works regardless of where the clone was attached.Testing Instructions
.components-draggable__cloneelement should be inside<div class="wp-overlay-legacy">rather than directly under<body>.appendToOwnerDocument: false) attaches the clone next to the dragged element — unchanged. Verify drag-and-drop still works.Escape. Verify the clone is removed.Testing Instructions for Keyboard
Drag-and-drop is a pointer-based interaction. Verify keyboard-equivalent block movement (the up/down arrow shortcuts in List View,
Ctrl+Shift+Dfor duplicate, etc.) still works — no changes are expected here.Use of AI Tools
This PR was authored with assistance from AI tooling (Claude). All code, copy, and structural decisions were reviewed by a human contributor.