feat(desktop/hotkeys): v1 directional pane focus + best-effort v1 override migrator
Summary
Two related hotkey fixes bundled together:
-
Restore directional pane focus in v1 workspaces. PR #3403 wired
Cmd+Alt+Arrowspatial pane focus for v2 but skipped v1, leaving v1 with no keyboard pane navigation at all. Reimplements the spatial neighbor walker against v1'sMosaicNode<string>tree (no cross-package coupling to v2'sLayoutNode) and addsFOCUS_PANE_LEFT/RIGHT/UP/DOWNhandlers to the v1 workspace route. Also teaches the recorder thatOptionis a legitimate app modifier on Mac (⌥⌫ etc.) and warns when an alt-only chord could mask typing special characters. -
Best-effort migrator for v1 hotkey overrides. The v1 recorder stored chords from
event.key— layout-dependent raw glyphs likemeta+,,ctrl+shift+@,meta+alt+ª— while the new store matches onevent.codenames. The previoussanitizeOverridewas strict (/^[a-z0-9]+$/) and silently dropped most real-world v1 entries. Extends it with a token rewrite pre-pass covering:- US-ANSI punctuation (
,→comma,[→bracketleft, etc.) - Shifted glyphs (
@→2,_→minus,?→slash, etc.) - macOS Option dead-keys (
ª→9,å→a,•→8, etc.)
The Mac Option table is gated behind a
navigator.keyboard.getLayoutMap()probe — on non-US Mac layouts (whereOption+Qproduces•instead ofœ), the glyphs fall through and drop rather than silently rebind to the wrong physical key. - US-ANSI punctuation (
Coverage
Validated against three real leveldb / app-state dumps captured from the indigo-pentaceratops (v1.4.7), tray-polling-fix, and hotkeys-fixes worktrees — every captured chord is locked in as a parametric test case. 20/20 entries from the v1.4.7 blob now migrate successfully (17 rewritten + 3 null unassigns). 64 tests total in overrideSanitizer.test.ts.
Test plan
-
bun test apps/desktop/src/renderer/hotkeys/utils/overrideSanitizer.test.ts— 64 pass -
bun run --filter=@superset/desktop typecheck— clean -
bun run lint— clean - Smoke test v1 workspace: build 2×2 pane grid, verify
Cmd+Alt+Arrowwalks to the spatially adjacent pane, edges are no-ops - Smoke test v2 workspace: same chord still works (no v2 files touched)
- Boot against an existing app-state.json with v1 overrides, confirm migration runs once and
localStorage.getItem('hotkey-overrides')contains the rewritten entries - Verify on a non-US Mac layout (or swap layout via System Settings): dead-key glyphs drop instead of being mis-rewritten
Summary by cubic
Restores Cmd+Alt+Arrow directional pane focus in v1 workspaces and migrates v1 hotkey overrides to the v2 format so users keep their shortcuts. Adds Mac-specific recording logic and a safety warning for alt-only chords.
-
New Features
- v1: Added spatial pane focus (left/right/up/down) using a Mosaic walker; binds
FOCUS_PANE_LEFT/RIGHT/UP/DOWNand no-ops at edges. - Recorder: Accepts Option-only chords on macOS and warns that Option shortcuts may block typing special characters.
- v2 behavior unchanged.
- v1: Added spatial pane focus (left/right/up/down) using a Mosaic walker; binds
-
Migration
- Converts v1
event.keychords (e.g., "meta+,", "ctrl+shift+@", "meta+alt+ª") toevent.codenames. - Rewrites US-ANSI punctuation and shifted glyphs; recovers macOS Option dead-keys only on US‑compatible layouts (via
navigator.keyboard.getLayoutMap()). - Drops ambiguous non‑US dead‑key glyphs instead of misbinding.
- Added focused tests covering real overrides.
- Converts v1
Summary by CodeRabbit
-
New Features
- Added directional pane navigation hotkeys (Focus Pane Left/Right/Up/Down) for easier workspace navigation.
- Enhanced macOS keyboard support with improved Option key recognition for custom hotkeys.
-
Improvements
- Better keyboard shortcut organization in settings with Navigation category.
- Improved hotkey sanitization and keyboard layout detection.