Skip to content

fix(abstract): recheck collisions after setting the drop target - #2205

Open
itisrmk wants to merge 1 commit into
clauderic:mainfrom
itisrmk:fix/collision-during-set-drop-target
Open

itisrmk wants to merge 1 commit into
clauderic:mainfrom
itisrmk:fix/collision-during-set-drop-target

Conversation

@itisrmk

@itisrmk itisrmk commented Nov 28, 2026

Copy link
Copy Markdown

Fixes #2198

CollisionNotifier disables the collision observer while setDropTarget waits for renderer.rendering. Any collision change in that window is skipped. Because isDisabled() is read untracked, enable() doesn't re-run the effect either, so if the pointer then stays still, dragOperation.target keeps the old droppable while collisionObserver.collisions already holds the new one.

After re-enabling the observer, the notifier now compares the latest first collision with the current drop target. If they differ, it calls the existing forceUpdate(), so the normal collision path applies the new target without waiting for another pointer move.

Tests: collision-notifier.test.ts covers a change from A to B and from A to no target during setDropTarget. Both fail on main and pass with the fix. The abstract and DOM test suites, the build, typechecks and Prettier pass. I added a patch changeset for @dnd-kit/abstract.

AI disclosure: I used an AI coding assistant (Devin) to write this change and its tests, and reviewed them.

@changeset-bot

changeset-bot Bot commented Nov 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a899808

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

This PR includes changesets to release 10 packages
Name Type
@dnd-kit/abstract Patch
@dnd-kit/collision Patch
@dnd-kit/dom Patch
@dnd-kit/geometry Patch
@dnd-kit/helpers Patch
@dnd-kit/react Patch
@dnd-kit/solid Patch
@dnd-kit/state Patch
@dnd-kit/svelte Patch
@dnd-kit/vue 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

This branch has not been deployed

No deployments
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.

[abstract] A collision change during setDropTarget is skipped; the drop target stays stale under a still pointer

1 participant