fix(web): keep empty workspace draggable on Windows - #6030
virtuscyber 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 90662e2 This is a straightforward UI fix that adds a draggable region for Electron/Windows when the workspace is empty. The component is minimal (renders a div with CSS classes only in Electron, nothing in browser mode) and includes tests. You can customize Macroscope's approvability policy. Learn more. |
CDVolvik
left a comment
There was a problem hiding this comment.
The gap is real, but there is already a solution to it one function away, and another instance of the bug in the file this PR edits.
NoActiveThreadState.tsx handles the same case inline:
className={cn(
"border-b border-border px-3 ...",
isElectron ? "workspace-topbar drag-region" : "workspace-topbar",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}Same SidebarInset / div / header shape, same inset class. So the repo already has an idiom for "empty state that still needs a drag region", and this adds a second one: a separate aria-hidden spacer element rather than the class on the existing header. In NoProjectsHero there is no header to hang it on, so a spacer is defensible, but it is worth a line in the PR saying why this is not just the NoActiveThreadState treatment, otherwise the next person has two patterns and no rule.
The one I would actually fix before merging: HostedStaticOnboardingState, in _chat.index.tsx, roughly forty lines below the change:
<header
className={cn(
"workspace-topbar border-b border-border px-3 ...",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>workspace-topbar with no drag-region. That is the same undraggable-topbar bug, in the same file, in the sibling empty state. Since it already has a header, it wants the NoActiveThreadState one-liner rather than the spacer.
Smaller: neither new test exercises the default.
renderToStaticMarkup(<DesktopTitlebarSpacer enabled />)
renderToStaticMarkup(<DesktopTitlebarSpacer enabled={false} />)Both pass enabled explicitly, but production always uses enabled = isElectron. The prop is covered and the wiring is not, so the component could stop reading isElectron entirely and both tests would stay green. Rendering it once with no props under a stubbed isElectron would pin the part that actually ships.
|
Superseded by #13713 ( |
What Changed
Why
On Windows 11, the no-projects workspace has no
drag-regionin the main pane. The sidebar header is therefore the only place that moves the window, and collapsing the sidebar removes the last draggable surface entirely.This reuses the existing
workspace-topbarsizing anddrag-regionbehavior, while rendering nothing in the browser. I searched the current open issues and PRs for the same no-projects/collapsed-sidebar drag failure and did not find an existing report or fix.UI Changes
There is no visual appearance change. This restores drag hit-testing across the empty workspace's titlebar-height strip on Electron; browser layout remains unchanged.
Before — Windows 11 reporter capture
The red-marked sidebar header was draggable. The purple-marked main titlebar was not; collapsing the sidebar removed the final drag surface.
After — native Windows validation with the sidebar collapsed
The green-marked strip is the new Electron-only drag surface. Native minimize, maximize, and close controls remain outside the highlighted region.
Interaction video
View/download the full 9-second MP4.
A native Windows workflow built exact PR head
90662e296ad4716d72959c31ec06e051ed0aa2e6, opened a clean no-projects state, collapsed the sidebar withCtrl+B, and dragged from the main workspace titlebar. Win32 coordinates confirmed that the application moved from(20, 40)to(136, 98)— a verified 116 × 58 px movement.10.0.26100(windows-latest)Verification
vp checkvp run typecheckvp test apps/web/src/components/DesktopTitlebarSpacer.test.tsx(2 passed)pnpm --filter @t3tools/web buildvp test: 7,292 passed / 7 skipped; two unrelated suites fail identically on currentmain(thread-transfer-report.test.cjsdiscovery andghostty-vt.wasm?inlineimport parsing)Checklist
Note
Low Risk
Small UI-only Electron hit-testing fix with no auth, data, or API changes; browser layout is unchanged.
Overview
Restores window dragging on Electron when the main workspace has no chat header—especially the no-projects landing and collapsed sidebar on Windows 11.
Adds
DesktopTitlebarSpacer, an Electron-only strip using existingworkspace-topbaranddrag-regionclasses; it renders nothing in the browser. The spacer is wired intoNoProjectsHeroon the chat index route. Regression tests cover Electron markup vs empty browser output.Reviewed by Cursor Bugbot for commit 90662e2. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix empty workspace drag region on Windows by adding
DesktopTitlebarSpacerOn Windows (Electron), an empty workspace with no projects had no draggable titlebar region, making the window difficult to move. A new
DesktopTitlebarSpacercomponent renders a hiddendivwithworkspace-topbar drag-regionclasses when running in Electron, and nothing otherwise. This component is added to theNoProjectsHeroview so the titlebar remains draggable on empty workspaces.Macroscope summarized 90662e2.