fix: prefer ancestor drop target over nearest-by-distance in DragManager#10170
Open
mvanhorn wants to merge 2 commits into
Open
fix: prefer ancestor drop target over nearest-by-distance in DragManager#10170mvanhorn wants to merge 2 commits into
mvanhorn wants to merge 2 commits into
Conversation
snowystinger
reviewed
Jun 9, 2026
snowystinger
left a comment
Member
There was a problem hiding this comment.
Looks good, reviewers will want to pull it down and copy the codesandbox into our storybook to verify as well.
I'll hopefully have some time to try it tomorrow.
snowystinger
approved these changes
Jun 9, 2026
snowystinger
left a comment
Member
There was a problem hiding this comment.
Verified locally, thank you!
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.
Summary
Drag and drop now prefers an ancestor drop target over a closer-by-distance sibling, matching how nested drop zones are expected to resolve.
Why this matters
Reported in #10055:
findNearestDropTargetpicked the geometrically nearest target, so a small drop zone next to a containing one could win even when the pointer was inside the container. The fix prefers an ancestor target when the pointer is within it, before falling back to nearest-by-distance.Changes
DragManager's target selection to prefer an ancestor drop target containing the pointer.Testing
Added a DnD test covering the nested-target case.
Fixes #10055
AI was used for assistance.