Repository navigation
Conversation
While a screenshot is pending, a hidden preview guest moves inside the window behind the app. Chromium paints a guest only near the window, so a fixed viewport much taller than the window came back cut off at the bottom. A hidden fixed viewport is now fitted to the window, the same way the open panel fits it.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Hidden previews now fit within the window so oversized tabs can be captured without losing their edges. The change preserves configured viewport dimensions and active-preview sizing, with limited presentation-only risk. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Measurements for this one, from macOS 26.5 (arm64) with Electron 44.10.1 and a 2560x1600 viewport at page zoom 2 in a 1900x1200 T3 window. Without this PR, a hidden tab's capture came back 2470x1560 instead of 2560x1600. Chromium rasters a child frame only inside its compositing rect ( With this PR the capture is whole. Its fitted guest is scaled down, so it is a bit softer, as you noted. On my fork, which also draws a capturing guest with #31568's full-detail transform, the fitted guest was sharp too: 36 of 36 snapshots at 2560x1600 were whole, sharp and current. That covers light and heavy pages, with the window in front, covered or minimized. One detail came up there. My fork's covered-window fix (discussed in #23139) draws one pixel of the guest's top-left corner above the app while capturing. Once the fitted guest was centred in its box, that pixel was no longer on the guest. Fitting with one scale for both sides, anchored at the box's top-left corner, fixed it. With main's placement this doesn't come up. |
Problem
A snapshot of a hidden preview tab whose fixed viewport is much larger than the window comes back cut off at the bottom. For example, a 1440 × 1700 tab in a 1000 px tall window captures only page y 0–1300. While a capture is pending, the guest sits behind the app at its full viewport size, and Chromium paints a guest only near the window. Details and repro: https://git.cafe/pingdotgg/t3code/issues/26964.
Change
The hidden size of a fixed viewport is capped at the window size, and the existing
resolveBrowserViewportLayoutfit then scales the guest down, the same way the open panel fits a viewport larger than itself. The guest keeps its CSS viewport, and the snapshot is whole. Because the guest paints at that scale, it is a little softer than a crisp capture. Tabs that fit the window and fill-mode tabs are unchanged.The hidden-size calculation moves from
HostedBrowserWebviewtoresolveHiddenBrowserViewportSizeinbrowserViewportLayout.ts, so that it can be tested. The component reads the window size throughuseSyncExternalStoreonresize.Scope and approval
Fixes https://git.cafe/pingdotgg/t3code/issues/26964 (not triaged yet). I believe this fits the small, focused fix exception: one web-only sizing rule for a hidden guest, plus its test. It does not change anything for tabs that fit the window.
Verification
browserViewportLayout.test.ts: a hidden 1440 × 1700 freeform viewport in a 1400 × 1000 window resolves to 1400 × 1000 and lays out within the window, and a 1280 × 800 viewport keeps its size. It fails onmain(88ab83e8bc), which has no capped hidden size. With the change,vp test run src/browser/browserViewportLayout.test.tspasses (3 tests).vp run check:changed: format, lint, knip, typecheck (36 packages), the tests beside the change (20 files) and the React compiler check pass.vp run dev:desktop, window 1400 × 1000, Browser panel collapsed. Claude Haiku 5.5 ranpreview_open(open: false),preview_resizeto freeform 1440 × 1700, andpreview_snapshot(save: true) on a page of 100 px bands labelled by y.main: 1280 × 1156, ending at y 1300.Claude Opus 5.5 (claude-opus-5-5) via Claude Code in T3 Code
Fixes #26964