Repository navigation
Draw Leaf's radios and checkboxes in Web Awesome's design - #5230
Merged
Merged
Conversation
leaf-agent
approved these changes
Nov 3, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 3, 2026
…copying them (#5247) `.choice` carried a hand copy of the radio and checkbox rules from Web Awesome's `native.css` (#5230). The build now takes that section from the installed package, the way it already generates the library's theme sheet, so a Web Awesome upgrade carries any change to those rules. `native.css` is one sheet meant to restyle the whole page: headings, lists, tables, buttons and every input. Loading it would restyle every Leaf page, so the build takes only its "Checkboxes + Radios" section. ## Changes - **`build/styles.mjs`** writes that section to `browser/styles/vendor/webawesome-choice.css`, scoped to `.choice`. An optional third member of a style entry names the section and the scope. If the section is renamed or removed, the build fails rather than shipping an empty sheet. The dependency publisher's list of generated sheets picks up the new output unchanged. - **`browser/shadow.css`** imports the generated sheet just before `controls.css`, in the same layer. Imported into a lower layer, it lost to Leaf's `:where()` input defaults: `.lf-ui-face`'s ink turned a checked radio's dot and a checkbox's tick ink. - **`controls.css`** keeps only Leaf's adjustments, 28 lines in place of 72 copied ones: - the mark sized to the label's text; - the library's default control outline, in place of Leaf's lighter field border; - a disabled choice fading as a whole, as the library's own label does. Inside `@scope`, a selector without `:scope` matches only below the root, so the region's `label:has()` rules never style the `.choice` label itself and reach only the mark; - the platform control in forced-colours mode. A scoped rule outranks an unscoped one of equal specificity, so each adjustment's selector carries one extra attribute. ## Testing - `leaf-dev stills` against #5230, for ten states with radios and checkboxes (playground, quoted playground, visual review, command reference, lf-shot options, settled options). There are no pixel differences. The only computed differences are the inputs' own line height, plus the font of the command reference's checkbox; neither draws any text. - A disabled choice computes the same as in #5230 in Firefox: the label at 0.5 opacity with a not-allowed cursor, the mark inside it unfaded. - Twelve Firefox captures of the comparison page, light and dark, at rest, hovered and focused, match #5230's exactly. - `test_plain_choices_stand_one_per_line_until_the_author_sets_columns`, `test_an_ordinary_page_is_drawn_as_written[form]` (its known class-vocabulary pins are unchanged), `test_each_control_archetype_holds_its_neighbours_still[visual-review-approval]`, `pnpm run check:browser` and `pnpm run test:browser`. A Web Awesome upgrade that changes these rules now changes Leaf's look by itself. The dependency PR that regenerates the sheet is where that shows. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
…ring probe (#5497) #5230 made visual review's "Looks right" checkbox a `.choice`, and a choice's label wears the focus ring for its input (`:is(.lf-choice, .choice):has(> input[data-lf-focus-visible])` sets `--lf-wears-ring: 1`, `browser/styles/components/controls.css`). The ring is painted on the label, but the test probe's `carriesFocus` (`tests/page_scripts/focus_rings.js`) didn't recognise that declaration, so it marked the label's ring as not the focused control's and `current_location_ring` returned `None`. `ringsDrawn` now credits the box the runtime's `ringBox` (`browser/runtime/focus.js`, exported through `browser/runtime/check-api.js`) names for the focused control, so the probe and the runtime share one reading of which box wears a ring. Only the test probe and the diagnostic check API change; nothing a user sees changes. `git bisect run` over the scheduled-run range `19757c94c59b..8b759a5` found #5230 (`b63836193`) as the first commit where the journey fails with `the focused destination paints no keyboard ring`. `test_an_authenticated_navigation_journey_becomes_credential_free_review_evidence` (`--run-nightly`) fails on main and passes with this change. The same step also unblocks `test_visual_review_keeps_its_inline_comment_editor_in_view_after_phone_resize[600|760]`. Its earlier `assert_keyboard_focus` calls now pass, and it fails later, at line 206, with `{'unobscured': False, 'inViewport': False}`. #5475 (#5228) already owns that failure. <details><summary>Other probe consumers run</summary> Passed with the change: `tests/browser/controls/test_rings.py`, the rest of `tests/browser/test_render_visual_review_journey.py`, `test_a_key_onto_a_control_at_a_scrollers_edge_shows_its_ring`, `test_escape_on_a_declaring_control_does_exactly_what_it_says`, `test_a_label_press_keeps_the_controls_current_keyboard_location`, two `test_render_pages.py` ring tests, and `tests/journeys/test_render_controls.py` (Chromium). Two tests failed both with and without the change, so the change didn't cause them: `test_trace_pointer_annotation_stays_inside_the_panned_image_viewport` (ring 5px outside the image viewport) and `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` (the diff file's inline response, which #5496 targets). </details> Closes #5460 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
#5501) In the stacked visual-review desk, the "Looks right" label no longer hangs past the edge of `lf-visual-review`. Between 720 and 920px that edge clipped the 5px of the label where its focus ring is drawn. This fixes the nightly `test_page_fixture_renders[visual-review-gallery]` failure. #5230 made the label a `.lf-choice`, which keeps its focus-ring room as padding, and moved it left by `--choice-pad` so the checkbox lines up with the caption's edge. In the wide desk that offset falls into the 24px workspace gap beside the case queue. Below the 58rem container query the desk stacks, so the detail sits on the review's own edge. In a full-height workspace the review is a scroller (`overflow: auto`) and clips anything past that edge. The stacked layout now resets the offset. That keeps #5230's alignment in the wide desk and gives the label its full ring room where it has no gap to use. **What changes on screen:** `visual-review-inspection` at 900×700. The checkbox and its label sit 5px further right, so the checkbox no longer lines up exactly with the caption text. At the state's default 1440×900 window `leaf-dev stills` reports no change. | Before | After | | --- | --- | |  |  | **Verification:** `test_page_fixture_renders[visual-review-gallery]` (`--run-nightly`) fails on main `f8808301f` with the three reported findings and passes with this change. `test_each_control_archetype_holds_its_neighbours_still[visual-review-approval]` passes. Closes #5465 — 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.
Leaf's radios and checkboxes now take Web Awesome's design instead of the browser's own controls. The browser's radio was a 13–14px ring filled white, stark on Leaf's cream and different in Firefox, Chrome and Safari. Web Awesome's mark is 1.25em of the label's type (18px beside a 14px label), filled with Leaf's field colour and outlined in a warm mid grey. A chosen radio shows an accent ring and dot, and a checked checkbox an accent box with a check. Leaf already ships Web Awesome for its sliders, selects and the trace's chooser, so the radios now match that library instead of carrying a look of Leaf's own.
The user chose this direction on the comparison page. After trying marks, chosen faces and arrangements live, they asked for "a nice UI library and a reasonable design from that" rather than a look Leaf designs.
Changes
.choice(controls.css) copies the input rules from Web Awesome's native styles (native.css, "Checkboxes + Radios", 3.14). That sheet restyles the whole document, so it can't be imported. The selectors weigh no more than.choice > input, so a page's own rule for its inputs still wins. In forced-colors mode the mark falls back to the platform control, and a disabled choice fades as the library's does.--wa-color-neutral-border-loud), which was still upstream's cool grey, as Leaf's muted ink at 75%. That border outlines an unchosen mark. Leaf's lighter field border, which the library's form-control token takes, left an unchosen mark under 1.5:1 against a card..choice, so every radio and checkbox Leaf draws has the same look. Each hangs by the choice's padding, so its checkbox keeps its place. Visual review drops the rules.choicenow supplies.Row heights are unchanged: a choice measures 30.3px tall before and after. Each label sits 4px further right. The trace's joined-button chooser keeps Web Awesome's button look.
Testing
rgb(25, 24, 21)).leaf-dev stillsfor the playground, visual review, the command reference, lf-shot's options, settled options and On me choices. The command reference changes only its checkbox, and lf-options' own marks are unchanged.test_plain_choices_stand_one_per_line_until_the_author_sets_columns,test_an_ordinary_page_is_drawn_as_written[form](its known class-vocabulary pins still match), andtest_each_control_archetype_holds_its_neighbours_still[visual-review-approval].A plain page that names its own class
choicealready took Leaf's aim floor; that is the open class-vocabulary obstacle intest_plain_pages.py. Such a page now takes the mark as well, unless it sets its inputs'appearance.