Repository navigation
fix(deck): stand down keyboard nav during an active dnd-kit keyboard drag - #67
Merged
Merged
Conversation
…drag #66's window-level j/k/c//Esc handler bails when a text field is focused, but a dnd-kit keyboard drag (#65) is driven from a <button> drag handle — so during an active keyboard reorder the same ArrowLeft/ArrowRight/Escape keys were handled by BOTH the KeyboardSensor and the column-nav handler. Track drag state in a ref (set on onDragStart, cleared on onDragEnd / onDragCancel) and bail the key handler while a drag is in progress, so the KeyboardSensor exclusively owns arrows/Escape until the column drops or the drag cancels. A merely-focused (not dragging) handle still allows nav, since arrows don't start a drag — only Space/Enter does. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
PR #66 added window-level keyboard navigation (
j/k/c///Esc) for deck columns. Its handler bails when a text field (input/textarea/select/contentEditable) is focused. But the drag-to-reorder from PR #65 uses dnd-kit'sKeyboardSensor, whose drag is driven from a<button>drag handle — not a text field. So during an active keyboard drag,ArrowLeft/ArrowRight/Escapewere consumed by both dnd-kit's sensor (to move/cancel the drag) and the column-nav handler (to move focus / clear focus) on the same keypress.Fix
Track active-drag state in a
draggingRef:trueonDndContextonDragStartonDragEndandonDragCanceldraggingRef.currentis trueSo during a keyboard reorder, the
KeyboardSensorexclusively owns arrows/Escape until the column drops or the drag cancels. A merely-focused (not dragging) handle still allows nav, because arrows don't start a dnd-kit drag — only Space/Enter does — so there's no over-suppression.Verification
tsc --noEmit: zero errors indeck-board.tsx(only the pre-existinglib/integrations/pypi.tserrors remain, untouched).eslint components/deck/deck-board.tsx: clean (exit 0).useEffectdependency array is unchanged (no re-bind, no stale closure).🤖 Generated with Claude Code