Repository navigation
Set file tree rows in mono again, the face the theme gives code - #5561
Conversation
A row is a button, so the UI face Leaf gives a shadow root's controls set it in the sans: a stated value beats the font Trees sets on the tree from the package's overrides. The row now inherits that font, monospace at --code-size, which is what the reading theme's header says trees wear. Rows stay 30px high.
leaf-agent
left a comment
There was a problem hiding this comment.
This fixes the rows by restating the font in the package. The cause is higher up: in a declared shadow tree, Leaf's UI-face default ranks above every rule Trees writes. surfaces.css describes that default (the :where(… :host :is(button, input, select, textarea)) rule) as one that "weighs nothing", where "any other rule that names one of these properties outranks it, a component's, a package's or the page's". That is true in the document, where layer.py places shadow.css in lf-base. In a shadow tree it is false: place(shadow, "lf-shadow", kernel, "shadow.css") puts it in lf-shadow, and CASCADE_LAYERS ranks that above lf-base. lf-base is the layer the cssWrappers.js seam in build/vendor.mjs wraps all of Trees' CSS in. Layer order beats specificity, so the zero-specificity default overrides Trees' [data-type="item"] { font-family; font-size; line-height }.
So font: inherit only puts back what Trees sets on the host, and it hits the same wall in a second place. It sits in lf-shadow too, and as a shorthand it states font-weight. Trees' &[data-item-search-match="true"] { font-weight: var(--trees-search-font-weight) } sits in lf-base and still loses. Rows that match a search stay at regular weight instead of 600, on main and with this change. The search is enabled (search: true in lf-file-tree.js). The search input's own font-family/font-size are overridden the same way.
A smaller fix keeps the stated contract: in shadow trees, rank the UI-face default below adopted widget sheets, as it already ranks in the document. For example, split it out of the lf-shadow placement into lf-reset or a tier ahead of lf-base. Then Trees' own rules for rows, the match weight and the search input all apply, this package rule isn't needed, and the next component placed in a declared tree doesn't need its own copy. Under AGENTS.md's "Fix the underlying issue", I'd make that change rather than this one, or say here why the default has to outrank adopted sheets in shadow trees. In that case surfaces.css's comment is what needs correcting.
…adow tree The default face of a native control weighs nothing in the document, at the head of lf-base. In a declared shadow tree it came in with the shared sheet in lf-shadow, above the lf-base rules a widget adopts and the layers a library such as Trees nests inside lf-base, so it set the file tree's rows and search field in the sans. It now has its own sheet, placed at the head of lf-base in the document and in lf-reset in a shadow tree, and the file tree's own rule for its rows is gone.
…me today (#5909) Six comments named things that have since moved or never existed, so a reader following them found nothing. Each now names what it means today. Only comments change, so no behavior moves and no test applies. - `src/leaf/render-checks/reachability.js`, `layout.js` and `tests/journeys/test_render_gate.py` named the `TINY_BOXES` and `MISPLACED_BOXES` constants. 90f9374 replaced those with the `tinyBoxes` and `misplacedBoxes` probes, which `render_gate/readings.py` evaluates. - `browser/styles/components/controls.css` placed `.lf-ui-face` in `surfaces.css`. #5561 moved that rule to `control-face.css`. - `browser/runtime/addressable-names.js` cited `../../references/page-authoring.md`, a path that doesn't exist. The naming contract it describes, including `x-name`, is in `skills/leaf/references/module-reading.md`, "Naming elements". - `browser/runtime/annotation-inventory.js` called the function `passageRow`. Its name is `passageRows`. The nightly survey found these. Co-authored-by: leaf-agent <[email protected]>
File tree rows show file names, which the reading theme sets in mono with other code (
packages/reading/defaults.css, "What it shows is mono: code, diffs, trees, timestamps"). Since #4724 they have been set in the UI sans instead, and the tree's search field with them.Leaf's default face for native controls caused it. That default is meant to weigh nothing, so that any rule a component, package or page states outranks it. In the document it stands at the head of
lf-baseand does. In a declared shadow tree it came in with the rest of the shared sheet inlf-shadow, which ranks abovelf-base, where a widget's adopted rules sit. Trees' rules sit lower still, in layers insidelf-base(thecssWrappers.jsseam inbuild/vendor.mjs), so the default outranked Trees' own fonts for its rows, which are buttons, and for its search field.The default now has its own sheet,
browser/styles/control-face.css, moved unchanged fromsurfaces.css.composed_sheetsplaces it at the head oflf-basein the document, as before, and inlf-resetin a shadow tree, below everything a widget adopts. The portable sheet keeps it first inside its nesting. The rule this branch first added to the file tree's package is gone, since Trees' own rules now apply.Every control in a shadow tree on
corpus,file-tree,file-tree-input,file-editor,worktree-diffsanddiff-thread-gallerywas compared withleaf-dev probe --base. Only the file tree's rows and search field changed, in Chromium and Firefox:system-ui, -apple-system, "Segoe UI", sans-serifui-monospace, SFMono-Regular, Menlo, monospaceRows take
--code-size: 13px at working density, as above, and 13.5px at reading density.A new browser test seats a bare button, one the widget dresses, and one a library layer inside
lf-basedresses in a declared tree. The bare one takes Leaf's face, and the other two keep their own. With the old placement the last two fail. The face-order, distribution, font-token, press-face, portable-page and file tree tests pass.