Repository navigation
fix(web): prevent Windows titlebar shift after restore - #5996
thiscallnet wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused Windows Electron titlebar bug fix that preserves native-control geometry during restore and updates only existing desktop layout paths. The change is bounded, platform-scoped, and introduces no API, data, security, billing, or static-analysis configuration changes. Notes:
You can add or adjust custom eligibility rules. Learn more. |
311ec12 to
3df68bf
Compare
3df68bf to
3a6912a
Compare
3a6912a to
ab688c9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ab688c9b84bdfc1afc9e69dc51300b18520d7cde. Configure here.
ab688c9 to
375cc3c
Compare
375cc3c to
021bfb1
Compare
CDVolvik
left a comment
There was a problem hiding this comment.
The .electron-windows height override lands, but it wins on source order rather than specificity, and that is worth making explicit.
.wco { --workspace-topbar-height: env(titlebar-area-height, 52px); } /* ~line 121 */
.electron-windows { --workspace-topbar-height: 40px; } /* ~line 1407 */Both are single-class selectors, so they tie on specificity and the later one wins. That is the intent, since the comment says the WCO height is transitional during restore, which is the whole bug. But it means the fix depends on the .electron-windows block staying below the .wco block in the file. Move it, split the stylesheet, or have a bundler reorder layers, and the value silently reverts to env(titlebar-area-height, 52px), which is the transitional value this PR exists to avoid. Writing it as .electron-windows.wco for the height too would make it two classes to one and take the ordering out of it.
Second thing, the 40 is duplicated across languages:
const TITLEBAR_HEIGHT = 40; // apps/desktop/src/window/DesktopWindow.ts:23/* Matches DesktopWindow TITLEBAR_HEIGHT; WCO height can be transitional during restore. */
--workspace-topbar-height: 40px;The comment is accurate today, and nothing keeps it accurate. Change TITLEBAR_HEIGHT and the CSS drifts silently, and the symptom that comes back is the exact shift this PR fixes. Since the main process already sets the electron-windows class, it could set the height as a custom property at the same time and delete the literal, or failing that a test asserting the two agree would at least make the drift loud.
Third, worth calling out in the description rather than changing: swapping the hardcoded h-[52px] for workspace-topbar in DiffPanelShell, ProjectSettingsPanel and UsagePage also pulls in the new 40px on Windows, and every element already using workspace-topbar goes 52 to 40 on Windows as well. ChatView's topbar, settings, usage, pull requests, NoActiveThreadState and the sidebar chrome header all shift by 12px. That is presumably the point, since 40 is the real titlebar height, but a reader of the title would expect a restore-time fix rather than a Windows-wide 12px change to every top bar, and reviewers checking screenshots should know to look beyond the restore case.
Adding win32 to the enter-full-screen / leave-full-screen wiring looks straightforwardly right.
Dismissing prior approval to re-evaluate 021bfb1
|
Note Written by Hi! We are cleaning up open PRs, and this one does not say which model or harness was used to create it. If this change is really important, we recommend rebuilding the PR with a newer model and noting the model and harness in the PR description. |

What Changed
Stabilizes the Windows desktop titlebar layout across minimize → restore transitions.
The last valid native window-controls geometry is preserved while the Window Controls Overlay is temporarily unavailable during restore, then refreshed once the restored window has settled.
Diff, Usage, Settings, and right-panel headers now use the same stabilized titlebar geometry. Other platforms keep the existing WCO behavior.
Why
On Windows desktop, restoring T3 Code after minimizing could briefly render titlebar content in the wrong position before snapping into place, including content shifting into the native minimize/maximize/close button area.
Preserving the last known-good geometry through the restore transition avoids rendering that intermediate layout while still allowing the native controls geometry to update normally afterwards.
UI Changes
Before
before.mp4
After
after.mp4
Checklist
Note
Low Risk
Desktop UI/layout only on Windows Electron; no auth, data, or API changes. Risk is limited to titlebar geometry regressions on other platforms if WCO sync behavior diverges.
Overview
Fixes a Windows desktop glitch where titlebar content jumped or overlapped the system buttons briefly after minimize → restore.
syncDocumentWindowControlsOverlayClassnow keeps the last good native control geometry on Windows when the Window Controls Overlay is temporarily unavailable during restore: it can leave thewcoclass applied, writes--workspace-native-controls-widthfromgetTitlebarAreaRect, and skips that preservation in fullscreen via new win32 fullscreen IPC fromDesktopWindow.CSS adds
.electron-windows/.wcovariables (fixed 40px topbar height, native-control insets) so layout does not depend on transitionalenv(titlebar-area-*)values during restore.Headers (diff panel, settings, usage, right-panel sheet) switch from hardcoded
h-[52px]/env(...)padding toworkspace-topbarand--workspace-native-controls-inset.Reviewed by Cursor Bugbot for commit 021bfb1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Windows titlebar shift after restore by preserving WCO layout during overlay hide
syncDocumentWindowControlsOverlayClassinwindowControlsOverlay.tsto track fullscreen state and overlay geometry separately, keeping thewcoclass active on Windows when the overlay becomes temporarily hidden (e.g. after restore from maximized) to prevent layout shift--workspace-topbar-height,--workspace-native-controls-inset, etc.) under.electron-windowsinindex.cssso components can size/pad consistently without hardcoded heights orcalc()expressionsDesktopWindow.tsto coverwin32in addition todarwin, so the renderer knows when to drop the preservedwcoclass during fullscreenworkspace-topbarandvar(--workspace-native-controls-inset)instead of fixed heights and calc-based paddingMacroscope summarized 021bfb1.