[Bug]: Snapshot of a hidden preview tab larger than the window is cut off at the bottom#26964

opened14d agobyJjason5545

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Run the desktop app (vp run dev:desktop on main) with a window shorter than about 1300 px. I used 1400 × 1000.
  2. Open a thread and keep its Browser panel collapsed.
  3. In that thread, have an agent run, in order:
    • preview_open with open: false on a page taller than 1700 px
    • preview_resize with { mode: "freeform", width: 1440, height: 1700 }
    • preview_snapshot with save: true

My test page stacks seventeen 100 px bands, each labelled with its y range.

Expected behavior

A 1280 × 1511 screenshot of the whole 1440 × 1700 viewport.

Actual behavior

The screenshot is 1280 × 1156 and shows only page y 0–1300. The bottom 400 CSS px are missing, and the result does not say the capture was cut.

Since #25184, a hidden guest moves inside the window, behind the app, while a capture is pending. HostedBrowserWebview sizes it to the full fixed viewport (viewport.height * layoutZoomFactor), without limiting it to the window size. Chromium paints a guest only within about 1.3 times the window in each direction (1000 × 1.3 = 1300 here), so the capture gets only that part.

A fork build that keeps agent tabs behind the app showed the same cut (1440 × 1700 in a shorter window captured only its top 1064 CSS px). In that build, Page.captureScreenshot with a clip or captureBeyondViewport returned the full size, but the part outside the painted area repeated the top of the page. So a capture option does not fix this. Capping the hidden viewport at the window size and letting the existing fit-to-container layout scale it does.

The desktop host tests added in #25184 check that a hidden guest paints while a capture is pending. They do not check how much of the guest gets painted, and a guest taller than the window is not covered.

Impact

Minor bug or occasional failure

Version or commit

main @ 88ab83e8bc

Environment

macOS 27.2 (Apple Silicon), Electron 44.10.0, vp run dev:desktop, Claude Haiku 5.5 driving the preview tools. Not checked on Windows or Linux.

Screenshots, recordings, or supporting files

Before (main, 1280 × 1156, ends at y 1300):

before

After capping the hidden viewport at the window (1280 × 1511, through the BOTTOM band):

after

Workaround

Open the Browser panel before the snapshot, or keep the fixed viewport within the window.