Repository navigation
fix(titlebar): keep chrome drag regions live while a terminal is focused - #17426
vodves-vodves wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between e2dfd0dec4f38d392231654029779458981fc01c and bfd853d. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change replaces terminal-focus-specific drag-surface attributes with Merge Risk: ⚪ Minimal · up to This PR keeps titlebar drag regions active while a terminal is focused and prevents text selection on those surfaces. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bf4bb451-12e9-4bbb-9c89-3389c4bb6671
📥 Commits
Reviewing files that changed from the base of the PR and between 89a4d67 and e2dfd0dec4f38d392231654029779458981fc01c.
📒 Files selected for processing (4)
src/renderer/src/assets/main.csssrc/renderer/src/components/tab-group/TabGroupPanel.tsxsrc/renderer/src/components/tab-group/TabGroupSplitLayout.tsxtests/e2e/titlebar-drag-with-terminal-focus.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Greptile SummaryThe PR keeps Electron titlebar and tab-strip drag regions active while terminal input is focused and updates the regression test to cover every rendered strip.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/assets/main.css | Removes the focus-dependent no-drag override and consistently styles marked window-drag strips as draggable and non-selectable. |
| src/renderer/src/components/tab-group/TabGroupPanel.tsx | Renames the tab-row marker to reflect its permanent window-drag behavior. |
| src/renderer/src/components/tab-group/TabGroupSplitLayout.tsx | Applies the renamed permanent drag-strip marker to the split layout’s top strip. |
| tests/e2e/titlebar-drag-with-terminal-focus.spec.ts | The regression test now checks every matching strip, resolving the previously reported first-element-only coverage gap. |
Reviews (3): Last reviewed commit: "test(e2e): assert every chrome drag surf..." | Re-trigger Greptile
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Removed terminal-focus drag gating —
src/renderer/src/assets/main.cssdrops the:root[data-regular-terminal-input-focused]block that flipped.titlebar,.titlebar-left,.window-controls-titlebar-spacer,.right-sidebar-header-drag, and the tab strips to-webkit-app-region: no-dragwhile xterm owned input focus. Each surface keeps its unconditionaldragdeclaration. - Renamed the tab-strip marker —
data-terminal-focus-release-surface→data-window-drag-stripinTabGroupPanel.tsxandTabGroupSplitLayout.tsx, withuser-select: noneadded to the strip to match.titlebar/.right-sidebar-header-drag. - Regression spec —
tests/e2e/titlebar-drag-with-terminal-focus.spec.tsfirst assertsdata-regular-terminal-input-focusedis actually published (so it can't pass vacuously), then checks the tab strip and.titlebar-leftcompute-webkit-app-region: draganduser-select: none.
I verified the supporting claims: every interactive chrome surface carries its own no-drag (the tab wrapper in tab-bar-surface.tsx, the + button, scroll arrows, pane-action buttons, .sidebar-toggle, .titlebar-app-name, and the reserved spacers), so clicks still route through the unchanged document-level pointerdown release in TerminalPane.tsx; and resolveZoomTarget continues to own Cmd/Ctrl +/- for the terminal until focus leaves xterm, which is the tradeoff the PR documents and the reasoning holds.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
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
e2dfd0d to
a161ecf
Compare
querySelector checked only the split layout's leading 4px strip, so a regression that returned the tab rows themselves to no-drag would have passed. Collect every match per selector and fail on any that is not draggable or selectable-free. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014PYpYoxCtNbgaGGMnLexVZ
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
a161ecf is a byte-identical re-author of the previously reviewed e2dfd0d; the only new code is bfd853d, which hardens the regression spec:
- Expanded the drag-surface assertion to every match — the spec now collects all
[data-window-drag-strip]and.titlebar-leftelements and filters offenders, so the split layout's 4px strip can no longer satisfy the check while a tab row the user actually grabs staysno-drag. - Added a loud-failure path for empty selectors — a per-selector
missingplaceholder feeds the offender filter, so a selector that matches nothing can no longer pass as an empty offender list.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
|
||
| // Why: a selector that matches nothing must fail loudly instead of leaving | ||
| // an empty list that trivially satisfies the offender check below. | ||
| expect(new Set(dragRegions.map((region) => region.selector))).toEqual( |
There was a problem hiding this comment.
This Set-equality check can never fail: flatMap always emits at least one entry per selector (a real match or the missing placeholder), so the returned selector set always equals the input set. The loud failure the comment above describes is actually the offenders filter catching the missing placeholder — consider dropping the tautological assertion or moving that comment to the offenders filter.

ELI5
The strip of chrome at the top of the Orca window is what you grab to move the window around, the way you would grab a native titlebar. While a terminal has focus — which is almost always — that strip quietly stopped being a window handle. The first press on it went into the app instead of to the operating system: the window did not move, and the app started selecting text under the pointer. You had to let go and do the exact same drag a second time before the window moved. This PR makes those surfaces window handles at all times, so the first press drags.
What Changed
src/renderer/src/assets/main.css: removed the:root[data-regular-terminal-input-focused]block that flipped.titlebar,.titlebar-left,.window-controls-titlebar-spacer,.right-sidebar-header-drag, and the tab strips to-webkit-app-region: no-dragwhile xterm owned input focus. Each of those surfaces keeps its unconditionaldragdeclaration.data-terminal-focus-release-surfacetodata-window-drag-strip(TabGroupPanel.tsx,TabGroupSplitLayout.tsx,main.css). The surface no longer releases anything; it is the window drag strip, and the old name would have described a mechanism that no longer exists.user-select: none, matching.titlebarand.right-sidebar-header-drag, so no press on it can start a selection.tests/e2e/titlebar-drag-with-terminal-focus.spec.ts.No other behavior is touched.
TerminalPane.tsxstill publishes terminal input focus to the main process and still releases focus on the document-levelpointerdown;resolve-zoom-target.tsis unchanged.Why
The tab strip stands in for a native titlebar, so it carries the window drag region. #6301 gated that region on terminal focus: while a regular terminal owned input focus, every top-chrome drag surface became
no-dragso that the click releasing terminal zoom ownership would be delivered to the renderer.The problem is the ordering. Electron hit-tests
-webkit-app-regionat mousedown, so a surface that isno-dragwhen the press lands swallows that press into the page. The document-levelpointerdownhandler inTerminalPane.tsxthen blurs the xterm helper textarea, the attribute clears, and the surface becomes draggable — but for the press that already happened it is too late. The window does not move, Chromium instead begins a selection drag (the strip had nouser-select: none), and only the second gesture moves the window.So the rule cost every user the first press of every window drag, in the app's most common focus state, on all three platforms.
Trade-off this accepts. With the drag region always live, a press on the empty part of the caption is consumed by the OS and no longer hands Cmd/Ctrl +/- from the terminal font to app zoom. That is defensible on its own terms: a native window drag does not move keyboard focus, so after dragging the window the terminal is still where typing goes, and zoom following it is consistent. Every genuinely interactive piece of chrome is
no-dragand still releases terminal focus through the unchangedpointerdownhandler — tabs, the "+" button, pane action buttons, the app name, the sidebar, the editor, the status bar. The affordance #6301 added is still reachable; it just no longer collides with dragging the window.Alternative considered and rejected. Keeping the release by having the main process report a window drag (
BrowserWindowwill-move) would restore the #6301 behavior only for drags that actually move the window, not for a click that does not, andwill-moveis not emitted on Linux. It adds an IPC path and platform-specific behavior to recover a case that already has many other entry points.Linked Issue
Fixes #17425
Visual Proof
No pixels change. The change is in how the OS hit-tests the same pixels, so a before/after screenshot pair would be identical. The observable difference is the first press:
-webkit-app-regionon the tab strip while xterm has focusno-dragdragThe "before" column is the reported behavior on Windows 11. The "after" column follows from the region being live when the press lands; see Testing for what was and was not executed locally.
Reproduce on either branch: focus a terminal, then press and drag the empty part of the tab strip.
Testing
New regression spec
tests/e2e/titlebar-drag-with-terminal-focus.spec.ts— focuses the active terminal, assertsdata-regular-terminal-input-focusedis actually published (so the test cannot pass vacuously if focus reporting regresses), then asserts the computed-webkit-app-regionof the tab strip and.titlebar-leftisdragand theiruser-selectisnone. Restoring the deleted CSS block makes it fail withno-dragon both.tsc --noEmitpasses for the node, cli, and web projects;oxlintis clean on the changed files.Unit tests for the touched areas pass:
regular-terminal-focus-ownership.test.tsplus the wholecomponents/tab-groupsuite (17 files, 117 tests).Not run locally: the E2E suite. This environment cannot download the Electron binary (
objects.githubusercontent.comis unreachable from it), so the new spec and the manual first-press drag are unverified in a running build here and rely on CI. The bug itself was reproduced by a user on Windows 11 and traced to the rule removed here; a reviewer who can launch the app should confirm the first press drags on macOS (hiddenInset), Linux, and Windows.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Investigated and written with Claude Code (Claude Opus 5). The root cause, the trade-off analysis, and the test were reviewed by hand against the code before opening this PR.
Review
.window-controlsstaysno-drag, so the Windows/Linux custom window buttons remain clickable, and the spacer they overlay is covered by the titlebar's own drag rect.main.cssis desktop renderer styling;mobile/is untouched.Agent skill upstream boundary
Checklist
N/Awith reasontsc --noEmit(node/cli/web) andoxlintpass locally; the E2E spec runs in CI (see Testing)🤖 Generated with Claude Code
https://claude.ai/code/session_014PYpYoxCtNbgaGGMnLexVZ