Repository navigation
Shoot untiled page shots at the viewport's width - #132
Merged
Merged
Conversation
fullPage sizes the image by the document's widest scroll/offset/client width, so an off-canvas box hidden by overflow-x widened the PNG and squeezed the page into its left part. Clip to the same area the tiled path already uses. Closes #115 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux, a capture beyond a wider-than-viewport document re-resolves the monospace fallback, so the text differs between sides on main too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page that really scrolls sideways keeps its wide shot, so the overflow still shows as a width change. The height is left to Playwright again, so an app shell whose body scrolls is shot in full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #115
Untiled page shots used
page.screenshot({ fullPage: true })with no clip. Playwright sizes that image by the widest of body and html scroll/offset/client widths. So an off-canvas box hidden byoverflow-x: hidden(metabase.com/product/starterat 1440) made the shot about 2× the viewport, with the page squeezed into its left part.The fix: when the viewport hides horizontal overflow, the untiled page shot is clipped to the viewport's width. The viewport's overflow is html's computed
overflow-x, or body's when html's isvisible, and "hides" meanshiddenorclip. The clip's height is1e6, which Playwright trims to the document's own height, so the height logic is unchanged.w±.Tests
offcanvas(new guard rail): the right side parks a box atleft: 100%behindbody { overflow-x: hidden }. Both sides are taller than the viewport, so both take the same capture path. At 1440 and 375 the test asserts a zero-pixel diff and a right PNG exactly the viewport's width. On main it readsw-1440.appshell(new guard rail):html { overflow: hidden; height: 100% }, with a body that scrolls 3,000px. The test asserts the shot is taller than 3,000px. A clip usingdocumentElement.scrollHeightcuts it to 900.--acceptwidth-change test (body { min-width: 2000px }), unchanged.Heads-up for release notes: shots of pages that hide horizontal overflow but have content past the right edge now narrow to the viewport. Accepted entries on those routes go stale once and need re-accepting, in CI. Other pages are unaffected.
🤖 Generated with Claude Code