Skip to content

fix(app): drag the desktop window from the session header gap - #57867

Merged
jlongster merged 3 commits into
betafrom
header-gap-drag
Oct 21, 2026
Merged

jlongster merged 3 commits into
betafrom
header-gap-drag

Conversation

@jlongster

@jlongster jlongster commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #48422

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On macOS with vertical tabs the titlebar is hidden, so the window can only be moved from the small strip by the traffic lights, and not at all once the sidebar is collapsed (#48422). The session header sits on that titlebar row, so this lets the window be dragged from it.

  • One drag area over the empty gap in the middle of the session header, from where the title (or its ⋯ button) ends to where the header actions start, mirrored in RTL. It is a single absolutely positioned element pinned to the session pane, outside the timeline's scroll container. I tried putting app-region: drag on the sticky header bar first, but Chromium only recomputes drag regions on layout, so after the timeline scrolled the region was left over the messages (dragging text moved the window) and the header stopped dragging. An element that doesn't scroll avoids that.
  • The gap is an empty flex-1 spacer at the end of the title slot (data-slot="session-header-gap"), rendered only while the title isn't being renamed. The active timeline hands it to the pane, and one ResizeObserver (pane, spacer, and the header row's sections) keeps the area over it at the header row's full height. Nothing runs while scrolling. The area is dropped when the gap is narrower than 24px or there is no active header. No header control sits under it, so none needs a no-drag exception.
  • The inset above the panels (--shell-top-inset: 8px on macOS, 1px on Windows where the titlebar already sits above it) is also a drag region now, as in fix(app): restore top edge dragging with vertical tabs #48619.
  • Only on macOS and Windows desktop. Web and Linux (native frame) get no drag elements.
  • Wheel scrolling over the gap no longer reaches the timeline (the area is a sibling of the scroller, and drag regions swallow wheel events on macOS anyway).

Known trade-offs on macOS (Electron behavior): wheel scrolling with the pointer over the gap doesn't scroll the timeline, and double-clicking the gap doesn't zoom (macOS only does that inside its own ~44px titlebar zone; the 8px strip does zoom).

Windows is untested: I only ran this on macOS. On Windows the area should drag, double-click should maximize and right-click should open the system menu, but someone needs to check.

How did you verify your code works?

Ran the dev Desktop app (Electron 44.9.1) against an isolated OpenCode Drive server with a long simulated session, with ELECTRON_DEBUG_DRAGGABLE_REGIONS=1 to see the regions, and drove it with real macOS mouse/wheel events (CGEvent), since Playwright clicks bypass the OS drag hit-testing:

  • Dragging in the gap moved the window, including right after scrolling the timeline up 600px and down 320px. Dragging the message text after scrolling did not.
  • The 8px strip and the existing titlebar still drag. The title and timeline body don't.
  • Real clicks on the breadcrumb, ⋯, title (rename), token readout, session details and panel toggle all worked and never moved the window.
  • Tab reorder still works (horizontal and vertical; dragging a tab over the header doesn't move the window).
  • The region follows the gap when renaming to a long or short title, opening the side panel and narrowing the chat pane by 250px, and in vertical tabs with the sidebar collapsed. It is hidden while renaming.

E2E: added a case in session-header.spec.ts that mounts the app with a desktop platform (the Windows-menu fixture now takes an optional path) and checks the area is a drag region spanning exactly from the ⋯ button to the actions and hides during rename; and a web case with no drag elements. session-header.spec.ts passes locally except "renames and closes the session tab from its context menu", which also fails on current beta. bun typecheck in packages/app passes.

Screenshots / recordings

Captured from the real app with Electron's draggable-region overlay (red = drags the window): the red block covers exactly the space between the ⋯ button and the token readout, plus the strip above the pane, and stays in place while the timeline scrolls. Happy to attach them here if useful.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jlongster
jlongster merged commit 3d52e83 into beta Oct 21, 2026
11 of 19 checks passed
@jlongster
jlongster deleted the header-gap-drag branch October 21, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant