Skip to content

fix: preserve valid make-child targets during drop redirection#186

Open
tensor2077 wants to merge 2 commits intolukasbach:mainfrom
tensor2077:fix-drag-and-drop-target
Open

fix: preserve valid make-child targets during drop redirection#186
tensor2077 wants to merge 2 commits intolukasbach:mainfrom
tensor2077:fix-drag-and-drop-target

Conversation

@tensor2077
Copy link
Copy Markdown

Fixes #0

@lukasbach

with.bug.mov
fixed.mov

getDragTarget redirects away from a valid MakeChild target when the parent target is invalid and canReorder is false

getDragTarget seems to discard a valid MakeChild target in this case:

  • the hovered item itself is a valid MakeChild target
  • its parent is not a valid drop target
  • canReorder is false

Expected: the current item should remain the final drop target.

Actual: getDragTarget recurses to the parent first, so the valid child target is lost and the drop never stabilizes on the current item.

The problematic branch seems to be the !canReorder && parent && !canBecomeSibling recursion running before the PlacementType.MakeChild return.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 1937844

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@headless-tree/core Patch
@headless-tree/react Patch
@headless-tree/sb-react Patch

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant