fix(desktop): focus xterm when v2 pane becomes active via FOCUS_PANE_* hotkey#3465
fix(desktop): focus xterm when v2 pane becomes active via FOCUS_PANE_* hotkey#3465manoffortune wants to merge 1 commit into
Conversation
…* hotkey setActivePane updates the store (ctx.isActive) but never called xterm.focus(), so Cmd+Alt+Arrow moved the visual focus indicator without transferring actual keyboard focus. Add a useEffect mirroring v1's useTerminalHotkeys pattern.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 Changes:
Confidence Score: 5/5Safe to merge — targeted, minimal one-file fix with no side-effects beyond the intended focus transfer. The change adds a single No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant HotkeySystem
participant PaneStore
participant TerminalPane
participant TerminalRegistry
participant XTerm
User->>HotkeySystem: Press Cmd+Alt+→ (FOCUS_PANE_RIGHT)
HotkeySystem->>PaneStore: setActivePane(newPaneId)
PaneStore-->>TerminalPane: ctx.isActive changes to true
Note over TerminalPane: useEffect fires<br/>[ctx.isActive, terminal]
TerminalPane->>TerminalRegistry: getTerminal(terminalId)
TerminalRegistry-->>TerminalPane: xterm instance
TerminalPane->>XTerm: terminal.focus()
Note over XTerm: Keyboard events now<br/>route to this terminal
Reviews (1): Last reviewed commit: "fix(desktop): focus xterm when v2 pane b..." | Re-trigger Greptile |
Summary
FOCUS_PANE_*hotkeys (Cmd+Alt+Arrow, added in feat(desktop/hotkeys): v1 directional pane focus + best-effort v1 override migrator #3460) visually moved the active pane indicator in v2 workspaces but never transferred actual keyboard focus to the new terminalsetActivePaneupdates the store (ctx.isActive) but there was no effect to callxterm.focus()— unlike v1, which has this inuseTerminalHotkeysuseEffectinTerminalPanethat callsterminal.focus()whenctx.isActivebecomes true, mirroring the v1 patternContext
PREV_WORKSPACE/NEXT_WORKSPACEare also reported as broken — this is intentional: theirCmd+Alt+Up/Downbindings were freed forFOCUS_PANE_UP/DOWNin c925f4d. Users can rebind them in Settings → Keyboard.Test plan
Cmd+Alt+→— confirm keyboard focus moves to the right pane (cursor blinks there, typing goes there)Cmd+Alt+←— confirm focus returnsSummary by cubic
Fixes v2 pane focus hotkeys so keyboard focus moves to the selected terminal when using Cmd+Alt+Arrow, not just the visual highlight.
setActivePaneupdatedctx.isActivebut never calledxterm.focus().useEffectinTerminalPaneto callterminal.focus()whenctx.isActivebecomes true, matching v1 behavior.Written for commit 1da365f. Summary will update on new commits.
Summary by CodeRabbit