Repository navigation
Let a themed page's own buttons, fields and choices wear Leaf's faces as plain HTML - #6224
Merged
Merged
Conversation
… as plain HTML A page took Leaf's control faces only by writing Leaf's class names: `lf-btn`, `lf-btn lf-commit`, `lf-field` and `<label class="lf-choice">`. Now the page's theme styles its bare controls. Where the theme turns on markup's reading face (`--lf-reading-face: 1`), as the bundled reading theme does, a `<button>` wears the word's face, `<button type="submit">` the commit's, `aria-pressed="true"` the selected toggle's, a text `<input>`, `<textarea>` or `<select>` the field's, and a radio or checkbox inside its `<label>` the choice's. The four class names leave the author's vocabulary: `page check` refuses them as Leaf's reserved names, and the kernel registry's three class idioms become `button` and `input, select, textarea` entries that say how to write each. How it works: - `build/styles.mjs` projects Web Awesome's native regions twice into `vendor/webawesome-native.css`: onto Leaf's role classes, as before, and onto a page's own controls (no `data-lf-offer`, not in the chrome), inside `@layer lf-reading-face` and `@container style(--lf-reading-face: 1)`. - `controls.css`, "A page's own controls", restates Leaf's departures from the library for them in the same layer and under the same input, at no weight, so any rule of the page's own, a package's or a theme's outranks them. One rule, moving a choice's ring from its mark to its label, stands in `lf-base` itself, since the band it answers stands there. - Leaf's own controls keep their role classes and faces on every page and in every tree; `lf-field` is gone even internally (Leaf's fields wear `lf-ui`), and `textarea.lf-field` became a page's bare textarea. Behaviour that changed: - A page with no theme, and a box that sets `--lf-reading-face: initial`, keep the browser's controls; such a page can no longer give one control Leaf's face by class. Its controls still take Leaf's UI font (control-face.css), as before. - On a themed page every bare control takes the face, so a control the page styles itself keeps the face on the properties its rules leave alone. - A page's button no longer takes the aim floor's reach that `lf-btn` gave it under a finger, since the reach's `::after` would reach into a page's own design. - Tests: the authored-markup reservation now refuses `lf-btn lf-commit`; the paper-and-ink and page-reset tests build Leaf's controls by role rather than writing `lf-btn`; the type tests compare with a Leaf-built press; the choice, aim and pin tests author bare controls; and `test_a_theme_gives_the_page_s_own_controls_leaf_s_faces` holds a themed page's controls to Leaf's faces and an unthemed page's to the browser's.
# Conflicts: # browser/AGENTS.md # browser/registry.json # browser/styles/components/controls.css # examples/developer/feature-gallery.html # tests/browser/controls/test_theme_and_device.py
The faces a themed page's own controls wear were a hand-written copy of Leaf's departures from Web Awesome, about 60 rules in controls.css held to Leaf's by an equality test. Now the build draws them from Leaf's own rules: the regions of controls.css marked `Face:` (word, choice, toggle, field) are projected onto a page's button, submit button, labelled choice and text field or select, the way Web Awesome's native regions already were, into a new generated sheet, `vendor/page-controls.css`, with the library's page projection beside them. Each rule stands once, an edit to a `Face:` region takes `pnpm run build:browser` to reach a page's controls, and `check:browser` fails until it has. `webawesome-native.css` holds Leaf's projection alone again. Behaviour that changed: - A page's controls stand in `lf-base` at no weight rather than in the reading face's sublayer, still under its input. In the sublayer the layer's band outranked the projected rule that moves a choice's ring from its mark to its label; any rule of the page's own still outranks them. - A page's `<textarea>` keeps the browser's face. Its card ground and line came only from the author-facing `textarea.lf-field` rule, and no rule of Leaf's own draws a textarea that way to project from. The registry entry is now `input, select`. - Leaf's choice names its focus box `label` rather than `.lf-choice`, the label it stands in either way, so the one value serves both projections. - The placeholder rule for fields inside Leaf's boxes stands apart from the field's own, so the projection carries only the field's. - `test_a_theme_gives_the_page_s_own_controls_leaf_s_faces` goes with the copy it held to Leaf's rules.
…af's faces On a themed page a bare button, a submit button and a text field compute the faces of Leaf's word, commit and field controls built by role; on a page with no theme they keep the browser's. The projection's equality test went with the hand-written copy, which left the feature itself untested.
leaf-agent
previously approved these changes
Nov 16, 2026
…ce on a themed page Two cases the projection of Leaf's control faces onto a page's own controls got wrong (review of #6224): - A pressed submit button (`type="submit" aria-pressed="true"`) took the selected toggle's accent rather than the pressed commit's settled face. In Leaf's own rules the pressed commit outranked the toggle by weight; the page's copies weigh nothing, so order alone ranks them, and the toggle came second. The pressed commit now follows the toggle in its `Face:` region, which leaves Leaf's own controls as they were, and the face section says a refining rule follows what it refines. - A radio or checkbox wrapped inside its label, as in `<label><span><input type="checkbox"></span>Include</label>`, took neither the choice's face nor its ring on the label, since both projections asked for the label's direct child. The choice now finds its mark at any depth in its label: Leaf's `.lf-choice` rules name the mark as a descendant at the weight they had, and the page's projection follows them. The feature test now also holds a pressed submit button to Leaf's pressed commit, and a nested mark to the choice's face and ring. The keyboard-focus journey's shadow-tree control is now built by role in its widget, as a widget builds one. It stood for a widget's own control as an authored `<button class="lf-btn">` staged into the shadow tree; without the class, a page's button there takes no theme face, since a declared tree resets the reading face, and the browser's shorter button left its ring's foot under the select that follows it.
leaf-agent
approved these changes
Nov 16, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 17, 2026
Merges main, whose #6224 reserves lf-choice, lf-field and lf-btn: the playground's examples, fixtures, tests, guide and eval inputs now write plain labels and fields, which a themed page draws with Leaf's faces, and the rail's and examples' rules name the label. Fixes from the review of #6231: - A radio group that reads none checked before the upgrade lost its check to a same-named group elsewhere on the page, since no press can clear a group; the drawing restores its value rather than reporting a selection it doesn't show. - A control its form attribute gives to a form is that form's, never a field, so two playgrounds no longer share radios a page's form claims. - Reset, and a preset for the fields it sets, rewrite those fields, so a number field the user cleared shows the value the playground sends. - A preset's colour may be written in capitals: the field holds it lowercase. - The focus-ring journey expects the plain label's ring on the notification playground's radios, rail and candidate alike.
This was referenced Nov 17, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 17, 2026
…oxes widget declarations The journey test's page registry added `required` beside the facts rather than under `attributes`, and the server test expected the retired `no-description` wording; both now read the declaration as it stands. `tinyBoxes` in two tests took the whole served registry, whose `button` idiom (#6224) it read as a declared tag, so it flagged the panel's buttons; it now takes the widget declarations, as the page check hands it. That second pair fails on main too.
leaf-agent
added a commit
that referenced
this pull request
Nov 17, 2026
…#6242) `test_the_gate_measures_an_inline_widget_by_its_words` has failed on main since #6224 added `button`, `input, select` and `table` entries to `browser/registry.json`. The test passed the probe the whole served registry, so `tinyBoxes` treated every `<button>` as a widget and held Leaf's own 32px page-menu button to the 40px width floor. The render gate itself never does this: `_render_page` in `src/leaf/render_gate/scheme.py` hands its readings `element_declarations(registry)`, which keeps only custom-element names (`is_element_name`). So `page check --render` raises no false `tiny-boxes` finding, and #6224's registry entries stay as they are. A new `page_declarations(page)` helper in `tests/render_harness.py` returns the served registry's element declarations. The tests that call `tinyBoxes` or `undeclaredAttrs` directly now use it, so each test asks the probe what the gate asks. No product code changes. The failing test now passes, and so do the two `undeclaredAttrs` callers (`test_a_widget_in_a_diff_line_thread_wears_its_package_s_look`, `test_settled_options_collapse_without_going_out_of_reach`). Its two sub-assertions still fire: with `x-inline` stripped, and with the gloss flattened. `tests/journeys/test_render_projection.py` still passes `page_registry` to `undeclaredAttrs`. I left that journey test alone because it isn't failing and I didn't run that tier here. Closes #6240 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 17, 2026
Since #6224 a page's own button takes Leaf's face by element, and stamping refuses one that writes the runtime's lf-btn class, which failed the site build on the feature gallery.
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.
Where a page's theme turns on the reading face, the page's own bare controls wear Leaf's faces:
<button>the word face,<button type="submit">the commit face, a text<input>or<select>the field face, and a checkbox or radio inside its<label>the choice face. The author writes plain HTML;lf-btn,lf-btn lf-commit,lf-fieldandlf-choiceleave the author's vocabulary andpage checkreserves them. A page with no theme keeps the browser's controls.Leaf's own control rules still live once, in
controls.css:build/styles.mjsprojects the regions markedFace: …onto page controls into the generatedbrowser/styles/vendor/page-controls.css, at zero specificity, so any rule of the page's outranks them, andcheck:browserfails on a stale projection. Three calls Max made: a page control with a class takes the face too, on whatever the page's CSS leaves unset; page buttons get no enlarged tap area, which would land on a page's own design; a<textarea>keeps the browser's look, since no Leaf control draws one to project from.Stills over the catalogue changed only page-authored controls and the layout that moved with them; nothing in Leaf's chrome or widgets. Scored on the four page-control eval cases (
page-css-names-leaf-controls,page-reset-stays-off-leaf-controls,changing-feedback-keeps-place,playground-case-is-independent) against main: 8 of 8 pass, Opus 5.5 author and judge. Tests:pnpm run check, the model tests on faces, sheets, registry and themes, the edited browser tests, and a new browser test that a themed page's bare button, submit and field compute Leaf's faces and an unthemed page's don't.Max picked this on a survey of places Leaf puts its own layer between authors and HTML.