Repository navigation
fix(desktop): allow hotkeys to trigger in editable content - #3418
Conversation
…ditor) react-hotkeys-hook skips events whose target is contentEditable unless enableOnContentEditable is set. CodeMirror 6 renders its editor as a contenteditable element, so app chords like cmd+w stopped firing when focus was in the v1 file editor — meta+w never reached the CLOSE_TERMINAL handler that closes the focused pane. Default enableOnContentEditable: true in useHotkey, mirroring the existing enableOnFormTags default. Callers can still opt out via options.
📝 WalkthroughWalkthroughThe hotkey hook configuration is extended to enable hotkey handling on Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes The fix adds Key observations:
Confidence Score: 5/5Safe to merge — minimal, targeted fix with no identified regressions. Single-line change that mirrors an existing default ( No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CodeMirror as CodeMirror 6 (contenteditable)
participant RHKH as react-hotkeys-hook
participant useHotkey
participant Handler as CLOSE_TERMINAL handler
Note over RHKH: Before fix: enableOnContentEditable defaults to false
User->>CodeMirror: Focuses editor
User->>CodeMirror: Presses cmd+w
CodeMirror->>RHKH: keydown event (target=contenteditable)
RHKH--xHandler: Skipped — contenteditable target
Note over RHKH: After fix: enableOnContentEditable: true in useHotkey defaults
User->>CodeMirror: Focuses editor
User->>CodeMirror: Presses cmd+w
CodeMirror->>RHKH: keydown event (target=contenteditable)
RHKH->>useHotkey: Hotkey match — passes through
useHotkey->>Handler: Calls CLOSE_TERMINAL callback
Handler-->>User: Pane closes
Reviews (1): Last reviewed commit: "fix(desktop): let app hotkeys fire insid..." | Re-trigger Greptile |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
…ditor) (ParadevAI#3418) react-hotkeys-hook skips events whose target is contentEditable unless enableOnContentEditable is set. CodeMirror 6 renders its editor as a contenteditable element, so app chords like cmd+w stopped firing when focus was in the v1 file editor — meta+w never reached the CLOSE_TERMINAL handler that closes the focused pane. Default enableOnContentEditable: true in useHotkey, mirroring the existing enableOnFormTags default. Callers can still opt out via options.
All 9 upstream commits have been individually cherry-picked via PR#159~#163: | Upstream | Our PR | Description | |---|---|---| | d656b7e (ParadevAI#3415) | #159 (PR#1) | terminal clipboard handling | | 31fcf19 (ParadevAI#3416) | #162 (PR#4) | v1 split pane startup sizing fix | | 039edf2 (ParadevAI#3403) | #161 (PR#3) | Cmd+Alt+Arrow spatial pane focus | | b18a00c (ParadevAI#3421) | #159 (PR#1) | v2 right sidebar toggle reactive | | 3dd1de2 (ParadevAI#3420) | #161 (PR#3) | v2 diff viewer + tab title resolution | | b42a114 (ParadevAI#3418) | #159 (PR#1) | CodeMirror hotkey enablement | | c925f4d (ParadevAI#3422) | #160 (PR#2) | unbound defaults + restore prev/next tab/workspace | | bb12c09 (ParadevAI#3419) | #163 (PR#5) | version bump 1.5.3 | | 47efa73 (ParadevAI#3432) | #159 (PR#1) | pending/update-required error selectable | Fork-specific features preserved: - auto-updater (IS_FORK, GitHub Releases API) - QuitMode/cleanupMainWindowResources lifecycle - GitHubSyncService, SpreadsheetViewer - BROWSER_RELOAD / BROWSER_HARD_RELOAD / SEARCH_IN_FILES hotkeys - HotkeyCategory "Browser" - v1 deep-link navigation (useSearch/WorkspaceSearchParams) - v1 tRPC-based PREV/NEXT_WORKSPACE handlers - v1 CLOSE_TERMINAL/CLOSE_TAB hotkey handlers - v2 extra state (rightSidebarOpenViewWidth, showPresetsBar)
Summary
react-hotkeys-hookskips keydown events whose target iscontentEditableunlessenableOnContentEditableis set. CodeMirror 6 (v1 file editor) uses acontenteditableeditor area, so cmd+w never reached theCLOSE_TERMINALhandler atworkspace/$workspaceId/page.tsx:220while the editor was focused.enableOnContentEditable: trueinuseHotkey, mirroring the existingenableOnFormTags: truedefault. Callers can still opt out viaoptions.Test plan
Summary by cubic
Restore cmd+w to close the focused pane when the v1 file editor (CodeMirror) is focused by allowing app hotkeys to fire inside contentEditable editors.
enableOnContentEditable: trueinuseHotkey(mirrorsenableOnFormTags: true); callers can override viaoptions.react-hotkeys-hookskipping keydown on contentEditable (CodeMirror), so cmd+w reaches the close handler again without changing other shortcuts.Written for commit 45d877b. Summary will update on new commits.
Summary by CodeRabbit