Skip to content

Fix browser view alignment at window zoom - #1244

Open
smsunarto wants to merge 1 commit into
get-bb:mainfrom
smsunarto:fix/browser-view-resize-sync
Open

Fix browser view alignment at window zoom#1244
smsunarto wants to merge 1 commit into
get-bb:mainfrom
smsunarto:fix/browser-view-resize-sync

Conversation

@smsunarto

@smsunarto smsunarto commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert renderer-measured browser bounds from zoomed CSS pixels to native window points before desktop IPC.
  • Apply the conversion to both initial browser attachment and later bounds updates.
  • Add a 125% zoom regression test for both paths.

Root cause

The browser panel chrome is part of the renderer and uses CSS pixel coordinates. The page is a native Electron WebContentsView, whose bounds use window coordinates. These coordinates match at 100% window zoom but diverge after the BB shell is zoomed.

The existing resize synchronization sent fresh bounds, but it repeatedly sent values in the wrong coordinate space. The native page therefore shifted left and overlapped the thread while the renderer-owned toolbar stayed in the correct right panel.

Manual bug repro

  1. Launch the BB desktop app.
  2. Open any thread.
  3. Open the right panel and select Open browser.
  4. Load https://example.com.
  5. Click the thread pane so the BB shell, not the embedded page, owns keyboard focus.
  6. Use View → Zoom In to increase the BB window zoom above 100%.
  7. Observe the browser page layer.

Before: The page layer shifts left and overlaps the thread pane. The tab strip, address bar, and other browser chrome remain correctly positioned in the right panel. Additional zoom steps increase the offset.

Expected: The page layer stays clipped below the browser toolbar and aligned with the right panel at every BB window zoom level.

Evidence

100% window zoom — control

The native page aligns with the right panel.

CleanShot 2026-08-09 at 20 20 29@2x

Increased window zoom — failure before this fix

The native page shifts left across the panel divider and covers the thread.

CleanShot 2026-08-09 at 20 22 56@2x

Verification

  • pnpm exec turbo run test --filter=@bb/desktop --force — 232 tests passed.
  • pnpm exec turbo run typecheck --filter=@bb/desktop --filter=@bb/desktop-contract — passed.
  • Red/green mutation check: removing the conversion makes the new regression test fail with raw, unscaled bounds; restoring it makes all five preload browser API tests pass.
  • Live isolated Electron check: example.com stayed aligned with the right panel after increasing the BB shell zoom.

Follow-up for #1089.

Scale renderer-measured browser bounds by Electron's current zoom factor before sending them to the native WebContentsView.

Cover both initial attachment and later bounds updates with a 125% zoom regression test.
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