Skip to content

refactor: unify keyboard handling on @opentui/keymap useBindings#44

Merged
viralcodex merged 1 commit into
mainfrom
add-keymap
Jul 6, 2026
Merged

refactor: unify keyboard handling on @opentui/keymap useBindings#44
viralcodex merged 1 commit into
mainfrom
add-keymap

Conversation

@viralcodex

@viralcodex viralcodex commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Migrate useKeyboard → declarative useBindings from @opentui/keymap/solid in useKeyboardNav, src/index.tsx (app-level double-escape), and organise.tsx (tool-window left/right paging).
  • Establish a single priority hierarchy: useKeyboardNav (100) > organise left/right (50) > app double-esc (10). Input-mode escape uses preventDefault: false so it exits input mode and bubbles to the double-esc handler.
  • Drop the duplicate enter binding (terminal keymaps emit return) and remove now-unused useKeyboard / KeyEvent imports.
  • Add @opentui/keymap@0.2.0 dependency.

Test plan

  • bun test — 111 pass, 0 fail
  • bun tsc --noEmit — clean
  • Manual: tab / shift+tab / j / k / up / down / return cycle focus in every tool view
  • Manual: single ESC in an input exits input mode; second ESC returns to the tools menu (double-esc still works)
  • Manual: left / right paging works in the organise tool window and does not fire when the tool window is closed or an input has focus

Migrate from useKeyboard to declarative useBindings across the app so
navigation, the app-level double-escape, and organise's left/right paging
share one keymap layer stack. Priorities (nav 100 > organise 50 > app 10)
plus preventDefault: false on escape let input-mode exit bubble to the
double-esc handler without both firing.
@viralcodex viralcodex merged commit 83f4ce7 into main Jul 6, 2026
1 check passed
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