Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: preview_snapshot of a resized desktop-drawn tab captures 1280×800 with the page in the corner #18593

Closedstromseng(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

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

Area

Not sure

Steps to reproduce

  1. macOS, desktop app on its bundled local server, display at 100% scaling (page reports devicePixelRatio 1).
  2. Have an agent call preview_open on any page, so the tab is drawn in the desktop webview.
  3. Call preview_resize with {"mode":"preset","preset":"iphone-12-pro"} (or freeform 600×400). preview_evaluate confirms the page now lays out at innerWidth 390, innerHeight 844.
  4. Call preview_snapshot with save: true and open the PNG.

Expected behavior

The PNG shows the 390×844 viewport, as it does for a headless tab: an earlier tab with the same preset, which the desktop didn't attach to and so ran headless, captured at 780×1688.

Actual behavior

The PNG covers a 1280×800 CSS px area. The 390×844 page sits in its left 390 px, and the rest is filled with the page background and a stray copy of the page's top-left. Its bottom 44 px fall outside the capture. Freeform 600×400 does the same. preview_resize also reports "viewport":{"width":1280,"height":800} for the desktop tab.

Cause, from main at 58d25323: applySetting returns early for desktop tabs, since the desktop lays its webview out itself (apps/server/src/preview/ServerBrowser.ts:655), so page.viewportSize() keeps returning 1280×800. snapshot and captureViewport take the clip's size from page.viewportSize() (apps/server/src/preview/ServerBrowserPage.ts:161 and :186), so they capture 1280×800 CSS px from the page origin, whatever size the page lays out at.

Related to #16690: same capture path and the same desktop-tab gap, but separate. That issue is about the clip's scale (display DPR); this one is about its size (the emulated viewport). On this 1× display both apply, so the phone preset comes back as a 640×400 PNG with a 195×422 page in it.

Screenshots: the test page has a tinted background, a yellow label with its size and DPR, and a 100 px red / blue / green ruler.

Impact

Minor bug or occasional failure

Version or commit

0.0.46-nightly.20261011.2967; line references at main 58d25323

Environment

macOS 26, desktop app on its bundled server, 3440×1440 display at 100% (DPR 1). Captures taken by Claude Code (Opus 5.5) through the T3 MCP preview tools.

Logs or stack traces

Screenshots, recordings, or supporting files

t3-snapshot-desktop-iphone-preset.png t3-snapshot-desktop-freeform-600x400.png t3-snapshot-headless-iphone-preset.png

Workaround

None reliable. A tab only runs headless, where the snapshot is right, when the desktop doesn't attach to it within DESKTOP_ATTACH_TIMEOUT, and the profile doesn't change that.

  1. stromseng(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. Note

    Grok responding on behalf of Julius.

    Open #16728 already covers this: for desktop-drawn tabs it reads the page's innerWidth/innerHeight (and DPR) for the snapshot clip instead of Playwright's leftover 1280×800 viewportSize(). Same root path as #16690; that PR now also closes this issue.

  3. juliusmarminge removed labelsneeds-triage

  4. juliusmarminge closed this

Sign in to join this conversation.