Repository navigation
Name a font in every rule that styles a widget, and keep the diff's renderer rules inside the diff - #5243
Merged
Conversation
…f class The font check (`tests/model/test_interface_fonts.py`) read a rule as Leaf's interface only when it named an `lf-` class, so the 26 rules that style a widget by its tag set their own faces unchecked, and those had drifted as the classes' had before #4774: a board card, a note on a line of code, a worktree and a review each set the small sans on a 1.5 leading, a playground's controls on 1.35 and its instruction on 1.55, a diff's notes at the prose rung, and the file editor its source at 0.88rem beside the theme's 0.84375rem code size. The check now reads a rule that names an `lf-` element too (an attribute such as `data-lf-state` qualifies an element rather than naming one), and every such rule names a font. Two fonts join the set in `styles/tokens.css`: - `--font-widget` (the small sans on the prose's 1.5 leading) for the words a widget holds: a card's, a code or diff note's, a review's, a worktree's, a row of options, a playground's instruction. - `--font-choice` (the interface font at 500) for a segmented control's choices, which hold the chosen weight so choosing never widens them: a dial's depths, a shot's views and tools, and the dial's placeholder, which measures those labels before the buttons arrive and now can't drift from them. What changes on screen, by `leaf-dev stills main` over 25 states (14 changed): - A diff's author notes go from 17px to 14px, the size a code note already took. - A playground's controls stand on the interface leading (1.45, from 1.35) and its instruction on 1.5 (from 1.55), about a pixel a line either way. - A board card's title takes a pane title's font: its line goes from 19.6px to 20.3px. - A worktree's disclosure takes the small font, so its 11.5px lines are 16.7px apart rather than 17.3px. - The file editor's source takes the theme's code size, 13.5px where it was 14.08px, and 13.12px on a phone, so `--lf-file-editor-size` goes and a page sizes the editor's code with `--code-size`, as it does every other source. The host's `font-family`, which only its wrappers inherited, goes too. Nothing else moves. Options' card and rail faces compute as they did, and the unused card value of `--lf-option-font` goes with the variable. A draft keeps its holder's size above the entry floor, which the check now allows for a box the user types in, as `surfaces.css` floors every field. The references point at `styles/tokens.css`, where the fonts have lived since #5121, rather than `base.css`. `test_file_editor_uses_package_typography_and_the_inherited_focus_ring` now sets `--code-size` on the editor where it set `--lf-file-editor-size`, and expects the theme's code size by default. > _This was written by Claude Code on behalf of max-sixty_
…n elements `layer.py` places each package's widget-shadow.css in the document's lf-base as well as in every declared shadow tree, with no scope around it, so each rule names the widgets it styles: by tag or `lf-` class in the document, by `:host(tag)` in a tree. Six of the diff's rules named only its renderer's attributes (`[data-separator]`, `[data-no-newline]`, `[data-line-type] [data-diff-span]`, `[data-line]` in print), so they also reached the page's own elements. A `leaf-dev probe` of the worktree example with a `<p data-separator>` added to it read the paragraph's background as rgb(246, 248, 250), the code ground, with `pre-wrap`; with each rule under `:where(:host(lf-diff))` it reads transparent and `normal`. The `:where()` keeps each rule's specificity, and `leaf-dev stills` over seven diff and worktree states shows no difference inside the diff. The separator's label, now a rule of the interface by naming the host, takes the small font on the code line (`font: var(--font-small); line-height: var(--code-line)`), the face it had. `test_a_sheet_both_trees_take_names_the_widgets_it_styles` reads every bundled package's widget-shadow.css, imports included, and fails a rule that names no `lf-` element or class and no `:host`; it fails on the six rules above without this change. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 3, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 3, 2026
Main now requires every rule of Leaf's interface to name a theme font (test_interface_fonts, #5243). The card's words take --font-widget, the font for the words a card holds beside the page's prose, where they were the document's serif; its head takes --font-small, a heading line 600, and code the source face's own inputs. The order test's long paragraph grows so it still overflows the card in the smaller face.
This was referenced Nov 5, 2026
Closed
leaf-agent
added a commit
that referenced
this pull request
Nov 6, 2026
…before measuring it (#5575) `test_a_short_workspace_shows_more_below_its_playground_regions` has failed on main since #5243 because the band it measures now holds no content, not because the cue stopped painting. #5243 set a playground's controls on the interface leading (1.45, from 1.35) on purpose. At the test's 1100×600 window that moves the notification playground's controls so the bottom 12px of the box falls on the gap between the Accent field (ending 336px into the box) and the Notification title control (starting at 346px, past the 349px edge). The cue's mask fades only background there, so the screenshot diff counts 24 changed pixels against the test's bar of 100. The test now scrolls the first control the box cuts off until its label sits under the cue, then checks that the box is still marked as having more below and measures it. The measurement is then of the fade over content, whatever leading the controls take. Product code and #5243's intent are unchanged. Verification: on main the test fails with `assert 24 > 100` (`uv run pytest --run-main` on that node). With this change it passes, and the cue reads 385 changed pixels. The rest of the test (focus lifting the cue, the end removing it) runs unchanged after the scroll. Closes #5490 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Two changes to how a package's rules meet the page: every rule that styles a widget by its tag now names one of the theme's fonts, and the diff's rules for its renderer's rows stop reaching the page's own elements.
Widget faces name the theme's fonts
The font check (
tests/model/test_interface_fonts.py) read a rule as Leaf's interface only when it named anlf-class, so the 26 rules that style a widget by its tag set their own faces unchecked, and those had drifted as the classes' had before #4774: a board card, a note on a line of code, a worktree and a review each set the small sans on a 1.5 leading, a playground's controls on 1.35 and its instruction on 1.55, a diff's notes at the prose rung, and the file editor its source at 0.88rem beside the theme's 0.84375rem code size. The check now reads a rule that names anlf-element too (an attribute such asdata-lf-statequalifies an element rather than naming one), and every such rule names a font.Two fonts join the set in
styles/tokens.css:--font-widget(the small sans on the prose's 1.5 leading) for the words a widget holds: a card's, a code or diff note's, a review's, a worktree's, a row of options, a playground's instruction.--font-choice(the interface font at 500) for a segmented control's choices, which hold the chosen weight so choosing never widens them: a dial's depths, a shot's views and tools, and the dial's placeholder, which measures those labels before the buttons arrive and now can't drift from them.What changes on screen, by
leaf-dev stills mainover 25 states:--lf-file-editor-sizegoes, and a page sizes the editor's code with--code-size, as it does every other source.Options' card and rail faces compute as they did, and the unused card value of
--lf-option-fontgoes with the variable. A draft keeps its holder's size above the entry floor, which the check now allows for a box the user types in, assurfaces.cssfloors every field. The references point atstyles/tokens.css, where the fonts have lived since #5121.The diff's renderer rules stay inside the diff
layer.pyplaces each package's widget-shadow.css in the document's lf-base as well as in every declared shadow tree, with no scope around it, so each rule names the widgets it styles: by tag orlf-class in the document, by:host(tag)in a tree. Six of the diff's rules named only its renderer's attributes ([data-separator],[data-no-newline],[data-line-type] [data-diff-span],[data-line]in print), so they reached the page's own elements too. Aleaf-dev probeof the worktree example with a<p data-separator>added read the paragraph's background as rgb(246, 248, 250), the code ground, withpre-wrap. With each rule under:where(:host(lf-diff))it reads transparent andnormal. The:where()keeps each rule's specificity, andleaf-dev stillsover seven diff and worktree states shows no difference inside the diff.test_a_sheet_both_trees_take_names_the_widgets_it_stylesreads every bundled package's widget-shadow.css, imports included, and fails a rule that names nolf-element or class and no:host. It fails on the six rules above without this change.Checks
test_interface_fonts.py, the new scoping check,pnpm run check(type check and runtime tests).