Skip to content

fix: hold lf-shot's toolbar row by the shot's full width before upgrade - #6195

Merged
max-sixty merged 1 commit into
mainfrom
fix/shot-placeholder-toolbar-breakpoint
Nov 18, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/shot-placeholder-toolbar-breakpoint

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Follow-up to #6191, as max-sixty asked there. Putting the stage's scrollbar gutter on the empty lf-shot made its query container two gutters narrower than the drawn shot's. On classic-scrollbar hosts, a shot 450–480px wide reserved the narrow toolbar's second row (~36px) before upgrade and dropped it after. The gutter now sits on a gutter-only ::after placed beside the frame (::before) in a row. The frame loses the two gutters, and lf-shot keeps its full width as the container.

Held vs drawn height, Chromium on Linux (15px classic gutters), from the new test test_a_shot_holds_its_drawn_height_on_either_side_of_the_narrow_toolbar:

outer width 430 450 455 465 480 640
drawn 293 303 269.5 274.5 282 362
held, before #6191 308 318 284.5 289.5 297 368
held, main (#6191) 293 303 305.5 310.5 318 362
held, this PR 293 303 269.5 274.5 282 362

The test fails on main and passes here. The other 17 shot tests in test_render_commands.py and test_bundled_widgets_meet_the_widget_quality_checks[default] pass. leaf-dev stills --state screenshot-startup is pixel-identical to main at the default window and at 490, 500 and 510px wide.

What the maintainer should weigh: Firefox

Firefox gives a pseudo-element's scrollbar gutter a classic scrollbar's width (12px a side) even when its scrollbars overlay. A real element in the same document gets 0, and so does the drawn stage. On Firefox with overlay scrollbars, this PR's held frame is therefore about 24px ÷ ratio short: 12px for the test's 2:1 capture, 3px at 640px, where the height cap applies. Main's CSS is exact in Firefox (measured in Playwright's Firefox), so this PR regresses it there. WebKit is unaffected.

Pure CSS can't avoid this. The only real element is lf-shot, and a gutter there narrows the container the toolbar's breakpoint reads. CSS can't carry a gutter's width from one box to another. So the choice is between:

  • this PR: Chromium and WebKit exact at every width; Firefox with overlay scrollbars is short by 24px ÷ ratio at every width.
  • main: exact everywhere except classic-scrollbar hosts (Chrome and Edge on Windows and Linux) at 450–480px, which reserve a second toolbar row.

I've left this unmerged for that call.

How the Firefox behaviour was measured

A probe with .s { display: flex }, a gutter-only .s::after { overflow: hidden; scrollbar-gutter: stable both-edges }, and a real <i> with the same style. Chromium: both 30px. Firefox: <i> 0, ::after 24px. Overflow auto/scroll, display: inline-block, contain: strict and grid in place of flex all give the same result. Running the new test in Playwright's Firefox, this branch holds 296/306/272.5/277.5/285/365 against a drawn 308/318/284.5/289.5/297/368, and main matches exactly.

#6191 moved the stage's scrollbar gutter from the placeholder frame onto the
empty `lf-shot`, which narrowed the shot's query container by two gutters.
On classic-scrollbar hosts a shot 450–480px wide then reserved the narrow
toolbar's second row before upgrade and dropped it after. The gutter now
sits on a gutter-only `::after` beside the frame in a row, so the frame
takes the stage's content width and the container keeps the shot's.

Firefox gives a pseudo-element's gutter a classic scrollbar's width even
with overlay scrollbars, so there the held frame is about 24px/ratio short.

The new test holds the runtime entry and compares each shot's held and
drawn heights at 430–640px.
@max-sixty
max-sixty merged commit a8dc692 into main Nov 18, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/shot-placeholder-toolbar-breakpoint branch November 18, 2026 04:14
leaf-agent pushed a commit that referenced this pull request Nov 18, 2026
…Firefox (#6400)

Corrects the claim #6195 left in `shot.css`, that Firefox gives a
pseudo-element's scrollbar gutter a classic scrollbar's width even where
its scrollbars overlay. The shortfall #6195 measured (held frame 12px
short, 3px at 640) comes from Playwright: its Firefox, when headless,
adds a user-agent sheet with `* { scrollbar-width: none !important }`
([`hidden-scrollbars.css`](https://github.com/microsoft/playwright/blob/main/browser_patches/firefox/juggler/content/hidden-scrollbars.css),
loaded in `Juggler.js` when headless). `*` misses pseudo-elements, so
the drawn stage gets no gutter while the held `::after` gets the classic
12px a side that headless Linux Firefox reports. Headed Linux Firefox
under Xvfb holds exactly with classic bars (24 / 24px gutters) and with
overlay bars (0 / 0), as do Chromium on Linux (30 / 30) and every engine
on macOS. The comment now states the condition (same computed
`scrollbar-width`) and the Playwright case. Only the comment changes.

Worth knowing beyond the diff: #6195's note that it regressed Firefox
came from the same sheet, so it changed nothing a Firefox reader sees.
Windows Firefox is unmeasured. The commit message has the per-engine
table.

Asked for by max-sixty, who hasn't read it yet. #6195's test passes in
Chromium on macOS and Linux; its body, run in Firefox and WebKit on
both, gives the numbers above.

> _This was written by Claude Code on behalf of max-sixty_
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.

2 participants