Repository navigation
fix: keep lf-note, lf-code's example and lf-shot at their first-paint size - #6191
Conversation
… 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 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
|
|
Follow-up is #6195. The gutter now sits on a gutter-only 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. |
…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]>
…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]>
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 mainf1b367375and passes on this branch, as do the other 19 tests intests/journeys/test_widget_quality.py.lf-note(from Draw code notes as cards under the key they explain, and let the reader hide them from the block's toolbar #6109). A docked note's left padding included its line's indent. The module copies that indent only when it docks the note, so a card sized to its words grew by indent × ch (333→365px for the example's 4-space line). The indent is now the note'smargin-inline-start, andmax-inline-sizesubtracts it. The words, card, caret and right edge stand where Draw code notes as cards under the key they explain, and let the reader hide them from the block's toolbar #6109 put them, and the box keeps its first-paint size.lf-code's registry example (from Name a code widget's language with a language-… class, as any code block does #6157). HTML drops a newline right after<pre>but not after a<code>inside it. The example's<code class="language-python">was followed by a newline, which painted a blank first row (about 20px) that the module then strips. The example now starts its code on the<code>line.lf-shot(from Hold lf-shot's drawn size from first paint, so the page below doesn't jump #6142). The placeholder frame (::before) had the stage'sscrollbar-gutter. A box'swidthincludes its own gutter, soaspect-ratiosized the frame from a width 2 × the gutter wider than the frame the module fits. On hosts with classic scrollbars (Linux, Windows) it held 2G/ratio too much: 18.75px for the example, where G is one 15px gutter. Hold lf-shot's drawn size from first paint, so the page below doesn't jump #6142 was measured on overlay scrollbars, where G is 0. The gutter now sits on the emptylf-shotitself, so the frame inside it takes the stage's content width. Chromium, Firefox and WebKit all giveaspect-ratiothat width-including-gutter behaviour (probed in the Playwright engines).What the reviewer should weigh
lf-shotcontainer 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.lf-codefinding 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 inexamples/anddocs/how-it-works.html, and thelf-codeinstruction 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, basef1b367375vs head):code-comparison,code-reader-feedbackandscreenshot-comparisonare pixel-identical.walkthrough-codechanges 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:Focused checks: the
note/shot/annottests intest_code_and_documents.pyand bothtest_render_commands.pyfiles (19 passed), andpnpm run check:browser.Closes #6181 — automated triage