Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End keyboard drag operation when pressing tab #1555

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Conversation

clauderic
Copy link
Owner

Resolves #857

This PR takes a different approach from #1087 and only de-activates the drag operation when the Tab key is pressed. This mostly accomplishes the same thing, but feels like a less risky change as there could be all sorts of factors that cause the draggable item to lose focus.

Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: 62f632a

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

This PR includes changesets to release 1 package
Name Type
@dnd-kit/core 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

@clauderic clauderic merged commit 14bd7d0 into master Dec 5, 2024
7 of 8 checks passed
@clauderic clauderic deleted the keyboard-end-on-tab branch December 5, 2024 17:00
@github-actions github-actions bot mentioned this pull request Dec 5, 2024
@jperals
Copy link

jperals commented Dec 12, 2024

Hi, thank you for this improvement. Note that if you lose focus with the mouse, you still get an inconsistent state where the option is shown as being dragged but it isn't. Also, I can recover focus with arrow keys but then I can't move the items. That is why in #1087 drag is deactivated on a blur event (it doesn't matter what causes it), and this doesn't happen.

Screen.Recording.2024-12-12.at.13.24.12.mov

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.

Cancel drag when the the draggable item loses focus
2 participants