Skip to content

Restore sortable previews when dropping outside all targets - #2217

Open
yucheng-du wants to merge 1 commit into
clauderic:mainfrom
yucheng-du:fix/reset-sortable-after-outside-drop
Open

yucheng-du wants to merge 1 commit into
clauderic:mainfrom
yucheng-du:fix/reset-sortable-after-outside-drop

Conversation

@yucheng-du

Copy link
Copy Markdown

Fixes #2214.

Drag A past C in a list ordered A, B, C, then release outside every target. On main the screen stays at B, C, A even though move returns A, B, C. The next drag also starts with the wrong indices.

The plugin now remembers the DOM position and sortable indices it actually changed. On an outside drop or Escape, it can put the item back in its original list, including when that list became empty. If a drag-over handler already committed the new order, that order stays in place.

The shared browser regression checks the order after release and after a second drag. The four Storybook suites passed (160 tests), along with the DOM and dependency unit suites (124 tests) and the full build. I also checked outside drops in Chromium, Firefox and WebKit with single lists and across lists.

The separate React reconciliation issue on a successful cross-list drop is tracked in #2102.

@changeset-bot

changeset-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ff2507

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/dom Patch
@dnd-kit/abstract Patch
@dnd-kit/collision 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.

Optimistic sortable order is not reverted when dropping outside all targets

1 participant