Skip to content

fix: keep lf-note, lf-code's example and lf-shot at their first-paint size - #6191

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6181
Nov 16, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6181

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Three default-package widgets drew a different box once presented than at first paint, so the content below them moved during startup. test_bundled_widgets_meet_the_widget_quality_checks[default] failed on all five findings in #6181. It fails on main f1b367375 and passes on this branch, as do the other 19 tests in tests/journeys/test_widget_quality.py.

What the reviewer should weigh

  • On classic-scrollbar hosts, the gutter on the empty shot narrows its lf-shot container by 2G. A shot whose width is within 30px above the 450px narrow-toolbar breakpoint therefore holds the narrow toolbar's height before upgrade. Before this change, every shot on those hosts was off by 2G/ratio. On overlay-scrollbar hosts nothing changes.
  • The authoring hazard behind the lf-code finding is wider than the example. Name a code widget's language with a language-… class, as any code block does #6157 wrote <pre><code class="language-…"> followed by a newline in about 14 places in examples/ and docs/how-it-works.html, and the lf-code instruction doesn't warn about the newline (lf-text-document's does). Those pages still paint one blank row before upgrade. Fixing them, and adding the sentence to the instruction (which would need an instruction score), is left out of this repair.

Drawn states (leaf-dev stills, base f1b367375 vs head): code-comparison, code-reader-feedback and screenshot-comparison are pixel-identical. walkthrough-code changes only in text anti-aliasing: the note crops match, and the indent now lands as a fractional margin rather than padding. screenshot-startup, the held placeholder, now reserves about 12px less, the gutter error for its 1800×746 shot:

before after
before after

Focused checks: the note/shot/annot tests in test_code_and_documents.py and both test_render_commands.py files (19 passed), and pnpm run check:browser.

Closes #6181 — automated triage

… size

Three widgets in the default package changed size between first paint and
presentation, failing test_bundled_widgets_meet_the_widget_quality_checks.

- lf-note (#6109): a docked note's left padding held its line's indent, which
  the module copies only once it docks the note, so a card that fits its words
  grew by the indent. The indent is now the note's inline-start margin and the
  measure gives it up, so the drawn card stands where it did, and its box keeps
  its first-paint size.
- lf-code's registry example (#6157): a newline after `<code class=…>` is
  text, unlike one right after `<pre>`, so the example painted a blank first
  row the module then dropped. The example starts its code on that line.
- lf-shot (#6142): the placeholder frame carried the stage's scrollbar gutter,
  and a box's `width` includes its own gutter, so `aspect-ratio` sized the frame
  from a width the gutter wider. On a host with classic scrollbars it held
  2G/ratio too much (18.75px at 720px). The empty shot now carries the gutter.

Closes #6181
@leaf-agent
leaf-agent merged commit fa9bc3c into main Nov 16, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6181 branch November 16, 2026 17:30
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The gutter change in this merged PR leaves a first-paint mismatch on classic-scrollbar hosts just above the 450px narrow-toolbar breakpoint. At a 465px outer width with 15px gutters on both sides, the undefined lf-shot is a 435px query container and reserves two toolbar rows; after definition the gutter leaves the host, the 465px container selects one row, and the extra reserved row collapses. This is the same box-stability guarantee the PR repairs. Please make a follow-up that keeps the query container width consistent before and after upgrade while subtracting the stage gutter from the placeholder frame, and check the 450–480px interval on a classic-scrollbar host.

This was written by Codex on behalf of max-sixty

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Follow-up is #6195. The gutter now sits on a gutter-only ::after beside the frame, so the frame subtracts it and lf-shot keeps its full width as the query container. In Chromium with 15px classic gutters, held and drawn heights now match at 430, 450, 455, 465, 480 and 640px. On main, 455–480 held about 36px extra. A new test covers this.

It does cost something in Firefox, so I've left it unmerged. Firefox sizes a pseudo-element's gutter as a classic scrollbar even when its scrollbars overlay. With overlay scrollbars, the held frame there is short by about 24px ÷ ratio at every width, where main is exact. The PR body has the numbers and the two options.

leaf-agent added a commit that referenced this pull request Nov 16, 2026
…h the held search before Shift+n (#6211)

Two tests failed in main's push run
[43928743834](https://github.com/max-sixty/leaf/actions/runs/43928743834)
(`3bc561561`). This PR fixes both, and changes only the tests.

- **`test_code_is_colored_without_a_word_moving`**: the test was stale
after #6191. That PR moved a docked `lf-note`'s line indent out of its
padding and into `margin-inline-start`, so the card keeps its
first-paint size. The card and its words still stand where they did, but
the note's border box now starts at the indent: 33.5px from the frame
for the example's 4-space line, where the test expected 1px. The test
now measures the note's margin box, which is what meets the frame (to
within 0.1px, since the indent is a fractional number of `ch`). It fails
on `main`. With #6191's `code.css` reverted, the old assertion passes.
-
**`test_a_step_back_after_the_page_changed_keeps_the_match_it_stood_on`**:
the test pressed before the page was ready. It released the held search
slices and pressed Shift+n at once. On a slow runner the search was
still going, so the step back stayed on the first match and said
"Searching", which is the behavior #5910 specified, and the wait for the
last match ran out at 120 s. The test now runs the held slices, and any
they schedule, until the search ends, and then presses. With `leaf-dev
suite flake --cpu-throttle 8`, it failed 4 of 18 copies before this
change and 0 of 18 after. It also passed 18 of 18 at throttle 16.

The other two failures in that run already have owners: #5642/#6130 and
#6139.

Not covered here: at throttle 8 to 16,
`test_code_is_colored_without_a_word_moving` also fails sometimes at an
earlier line. The test reads the `lf-code` token colours before
`bucket_key` is split into its own span. CI has not shown this failure,
and it happens with or without this change.

Refs #3985 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 18, 2026
…de (#6195)

Follow-up to #6191, as max-sixty asked
[there](#6191 (comment)).
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.

<details><summary>How the Firefox behaviour was measured</summary>

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.

</details>

Co-authored-by: leaf-agent <[email protected]>
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.

test_bundled_widgets_meet_the_widget_quality_checks[default]: lf-note, lf-code and lf-shot change their first box since #6109, #6157 and #6142

2 participants