Repository navigation
Zoom the app after leaving terminal focus - #6301
Conversation
Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThe renderer adds shared regular-terminal focus ownership helpers and wires 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/TerminalPane.tsx (1)
1419-1486: 🎯 Functional Correctness | 🟠 MajorDon't key the teardown cleanup off
document.activeElement.If this pane unmounts while it owns terminal focus, the helper can disappear before the effect cleanup runs. Then lines 1482-1486 skip
syncFocused(false), leaving bothdata-regular-terminal-input-focusedandwindow.api.ui.setTerminalInputFocusedstucktrue. The next zoom shortcut still routes to terminal, and the top chrome can stayno-dragafter closing or switching away from the focused terminal.Suggested fix
useEffect(() => { const container = containerRef.current if (!container) { return } + let ownsRegularTerminalFocus = false const syncFocused = (focused: boolean): void => { + ownsRegularTerminalFocus = focused setRegularTerminalInputFocusAttribute(focused) window.api.ui.setTerminalInputFocused?.(focused) } @@ return () => { container.removeEventListener('focusin', onFocusIn) container.removeEventListener('focusout', onFocusOut) document.removeEventListener('pointerdown', onPointerDown, true) window.removeEventListener('blur', onWindowBlur) window.removeEventListener('focus', onWindowFocus) - if ( - isXtermHelperTextarea(document.activeElement) && - container.contains(document.activeElement) - ) { + if (ownsRegularTerminalFocus) { syncFocused(false) } } }, [])
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a5af6bff-29f3-47d2-b66c-2448108ee868
📒 Files selected for processing (10)
src/renderer/src/assets/main.csssrc/renderer/src/components/tab-group/TabGroupPanel.tsxsrc/renderer/src/components/tab-group/TabGroupSplitLayout.tsxsrc/renderer/src/components/terminal-pane/TerminalPane.tsxsrc/renderer/src/components/terminal-pane/regular-terminal-focus-ownership.test.tssrc/renderer/src/components/terminal-pane/regular-terminal-focus-ownership.tssrc/renderer/src/components/terminal-pane/useTerminalFontZoom.test.tssrc/renderer/src/components/terminal-pane/useTerminalFontZoom.tssrc/renderer/src/hooks/resolve-zoom-target.tssrc/renderer/src/hooks/useIpcEvents.test.ts
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
While xterm owned input focus, every top-chrome drag surface flipped to -webkit-app-region: no-drag so the click that releases terminal zoom ownership (stablyai#6301) would reach the renderer. Electron hit-tests app-region at mousedown, so that press was consumed by the page: it started a text selection, the window did not move, and only a second press dragged it. Drop the focus-gated override. Interactive chrome is no-drag anyway and still releases terminal focus through the unchanged pointerdown handler; a press on the empty caption is now an OS window drag, which does not move keyboard focus, so zoom staying with the terminal is consistent. Rename data-terminal-focus-release-surface to data-window-drag-strip and give it user-select: none, matching the other drag surfaces. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014PYpYoxCtNbgaGGMnLexVZ
|
thanks for reporting. looking into it |
|
thanks for reporting. looking into it |
Co-authored-by: Orca <[email protected]>
Summary
Design And Review
WebkitAppRegionto a CSS data attribute so the focused-terminalno-dragoverride can win.Verification
Product Validation
brennanb2025/reset-terminal-zoomwithdemo-projectactive.data-regular-terminal-input-focusedand focusesTEXTAREA.xterm-helper-textarea..playwright-cli/page-2026-06-24T22-23-16-741Z.png.Checks
git diff --checkpnpm exec oxlinton touched filespnpm run typecheckpnpm run lintbrowser-guest-ui.test.ts,browser-manager.test.ts, anduseIpcEvents.test.tsregular-terminal-focus-ownership.test.ts,useTerminalFontZoom.test.ts,useIpcEvents.test.ts,createMainWindow.test.ts,window-shortcut-policy.test.ts,TabGroupSplitLayout.test.ts,TabGroupPanel.context-menu.test.ts,right-sidebar-titlebar-drag-regions.render.test.tsx(8 files, 176 tests passed)Assumptions And Gaps
Not authorized to send Apple events to System Events. (-1743).terminal:zoomand renderer routing from released terminal focus to app UI zoom, while live Electron validation proves the focus-release state transition in the running app.7d56c278a, and later added2974f7703so focused browser guests forward keyboard zoom to app zoom instead of browser page zoom. Waited 8 minutes after each push; refreshed CodeRabbit reported no actionable comments, and finalgh pr checksreportsverifypassing.Made with Orca 🐋