Skip to content

fix(desktop): keep the framed titlebar identity clear of native caption controls - #678

Open
wuzao368 wants to merge 1 commit into
anywhere-labs:masterfrom
wuzao368:fix/titlebar-identity-overlap
Open

fix(desktop): keep the framed titlebar identity clear of native caption controls#678
wuzao368 wants to merge 1 commit into
anywhere-labs:masterfrom
wuzao368:fix/titlebar-identity-overlap

Conversation

@wuzao368

Copy link
Copy Markdown

Problem

On Windows (compatibility / extended modes), when the main window is narrow, the centered title-bar identity row — product name, version pill, and presentation-mode pill — overflows into the rightmost native caption-controls strip reserved for the titleBarOverlay buttons. Because the overlay background is fully transparent (#00000000), the version/mode pills remain visible underneath the native minimize / restore / close glyphs, which renders as colliding or overlapping buttons.

The overlap happens whenever the identity's natural width (≈210–270px) exceeds windowWidth − 292px (below roughly 370–430px window widths). Restored narrow bounds from older builds (persisted main-window-state.json) or high-DPI configurations make this easy to hit.

Root cause

src/client/extended-styles.ts positions the identity with:

.dshDesktopFrameIdentity {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* no width cap — content overflows into the native-controls strip */
}

The frame is viewport-centered while the frame padding is asymmetric (0 146px 0 8px on win32), so the centered box needs a cap that reserves the full native strip on both sides: 2 × (WINDOWS_CAPTION_CONTROLS_WIDTH + 8) = 292px on win32, 2 × (MACOS_TRAFFIC_LIGHT_SAFE_WIDTH + 8) = 176px on macOS.

Fix

  • Cap .dshDesktopFrameIdentity to the visible title-bar band per platform (max-width: calc(100% - 292px) / calc(100% - 176px)), so it can never reach the native controls at any window width. The identity always stays within [146, W−146] on Windows — 8px clear of the overlay strip on the right, clear of the action buttons on the left.
  • Let identity children shrink (min-width: 0) and truncate with an ellipsis instead of spilling.
  • Hide the decorative product label below 480px so the interactive version/mode pills stay readable on narrow windows.

Supported window widths (≥ 640px) are unaffected — the cap only engages below ~566px.

Verification

  • yarn workspace dsh-plugin-desktop typecheck — passes (all 5 tsconfigs).
  • vitest run tests/client-environment.spec.ts — 20/20 pass, including new regression assertions for the identity cap, child shrink/ellipsis rules, and the narrow-width media query.
  • Geometry simulation across 324/400/480/560/640/900/1280px widths: the identity span [146, W−146] never intersects the native overlay zone [W−138, W].

Notes

  • The auxiliary native-ui frame header (dshNativeFrame) is an empty drag strip and the advanced-mode caption row is empty (aria-hidden), so neither has this surface.
  • Screenshot of the original overlap: title bar shows the mode pill colliding with the native restore button at a ~324px-wide window.

…on controls

On narrow windows the viewport-centered identity row (product name,
version pill, presentation-mode pill) overflows into the rightmost
native caption-controls strip reserved by titleBarOverlay, so the
pills visually collide with the minimize/restore/close glyphs.

Cap the identity to the visible title-bar band (2 * (caption width +
padding) on both sides of the viewport center), allow its children to
shrink with ellipsis, and hide the decorative product label below
480px. The identity can no longer reach the native controls at any
width; supported window widths (>= 640px) are unaffected.
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