Skip to content

Decouple keyboard navigation and simplify drop logic (Stack 3/4) - #393

Closed
ccombe wants to merge 4 commits into
jameskerr:mainfrom
ccombe:guard-clauses-and-cleanup
Closed

ccombe wants to merge 4 commits into
jameskerr:mainfrom
ccombe:guard-clauses-and-cleanup

Conversation

@ccombe

@ccombe ccombe commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Part 3 of the @dnd-kit migration stack (#390).
Note: This PR is in draft mode and branches from #392 (drag-overlay-modernization). Once #391 and #392 are merged, this branch will be rebased onto main.

Summary

  • Deduplicates redundant computeDrop branches for items and closed folders.
  • Extracts the 190-line onKeyDown handler from DefaultContainer into modular tree command handlers in handle-tree-key-down.ts using early return guard clauses, fulfilling the original code's "Future clean up welcome" note.
  • Expands unit test coverage for tree keyboard navigation (ArrowDown, ArrowUp, ArrowRight, ArrowLeft, Home, End).

Changes

  • dnd/compute-drop.ts: Merge duplicate isItem(above) and isClosed(above) branches into a single branch.
  • components/handle-tree-key-down.ts: Extract modular key handlers (handleBackspace, handleArrowDown, handleArrowUp, handleArrowRight, handleArrowLeft, handleSpace, handleEnter, handleTypeahead).
  • components/default-container.tsx: Simplify onKeyDown from 200 lines to a single delegation call.
  • components/default-container.test.tsx: Add keyboard navigation test assertions.

Verification

  • Unit tests: All 142 tests pass warning-free (yarn workspace react-arborist test).
  • E2E tests: All 4 Cypress specs pass (yarn workspace e2e test).
  • Lint and formatting: Oxlint and Oxfmt pass cleanly with 0 warnings.

@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for react-arborist ready!

Name Link
🔨 Latest commit 7503639
🔍 Latest deploy log https://app.netlify.com/projects/react-arborist/deploys/6ad8856a31c937e6c0682df8
😎 Deploy Preview https://deploy-preview-393--react-arborist.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ccombe

ccombe commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Moved out of the migration stack: this work does not depend on @dnd-kit, so it is now tracked as #397. The branch guard-clauses-and-cleanup is kept for when the migration lands.

@ccombe ccombe closed this Oct 27, 2026
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