fix: set operation.shape before computing initial transform in Feedback plugin#1988
Open
fix: set operation.shape before computing initial transform in Feedback plugin#1988
Conversation
…ck plugin (closes #1986)
🦋 Changeset detectedLatest commit: 8a8f19c The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@dnd-kit/abstract
@dnd-kit/collision
@dnd-kit/dom
@dnd-kit/geometry
@dnd-kit/helpers
@dnd-kit/react
@dnd-kit/solid
@dnd-kit/state
@dnd-kit/svelte
@dnd-kit/vue
commit: |
…ck plugin (closes #1986) Add e2e tests for modifiers (vertical axis, horizontal axis, restrict to window, snap to grid).
clauderic
commented
Apr 13, 2026
Owner
Author
clauderic
left a comment
There was a problem hiding this comment.
❌ Broken animation on multiple lists keyboard sorting
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.
Fixes #1986
Root cause
In
Feedback.ts, the initial transform was computed (line 313) before the feedback element's shape was measured and set ondragOperation(lines 391–392). This meant that on the very first call tomodifier.apply(),operation.shapewas alwaysnull.The ordering was:
feedbackElement.setAttribute(ATTRIBUTE, 'true')— gives elementposition: fixeddragOperation.transformread → modifiers called withshape = null❌styles.set(...)— positions the feedback element correctlyconst initialShape = new DOMRectangle(feedbackElement)→dragOperation.shape = initialShapeFix
Reorder so styles are applied first, then shape is measured and set, then the transform is computed:
styles.set(...)withinitialTranslate(no drag-transform offset yet)const initialShape = new DOMRectangle(feedbackElement)→dragOperation.shape = initialShapedragOperation.transformread → modifiers now haveshape.initial✅styles.set({ translate })— update translate with the modifier-adjusted valueOn the first frame
position.deltais{x:0,y:0}, so for modifiers that don't use shape the secondstyles.setis a no-op. For shape-dependent modifiers (snap-to-cursor etc.) it correctly applies the adjusted translation.This restores the v1 behaviour where
draggingNodeRectwas always populated when a modifier ran.Test plan
operation.shape?.initial— verify the rect is non-null on the first frameDragOverlayAutomated fix by Claude Code