Skip to content

Draw each control's look only from its role, and refuse a sheet that restyles one elsewhere - #5329

Merged
max-sixty merged 16 commits into
mainfrom
role-face-overrides
Nov 4, 2026
Merged

max-sixty merged 16 commits into
mainfrom
role-face-overrides

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Every control Leaf builds through a role (offerAction, offerActionElement, actionClass; the roles are in browser/runtime/control-faces.js) now takes its ink, ground, frame and lift (color, background, border, box-shadow, filter) only from its role's rules in browser/styles/components/controls.css. Where two controls of one role look different, the difference is a variant the role declares, keyed by an attribute on the control. Before this, 63 rules across 12 sheets restyled a role's control by its own class or by where it stood, so one role could look several ways, and knowing how a control looked meant reading every sheet.

The check

test_a_press_wears_its_role_s_face_alone (tests/model/test_interact_layer.py) reads every runtime and package stylesheet with tinycss2. It refuses a rule that sets one of those properties on a role's control unless the rule is in controls.css, names the control by its role's class, and narrows only by attributes or states of the control or what holds it. A new dressings reading in tests/js_facts.mjs lists the classes each role builder writes beside the role, so a rule keyed on such a class is caught too. test_the_face_reading_refuses_what_restyles_a_press plants each passing and failing shape, including the routes around the check that review found: a class written as an attribute selector, an id, @scope, a link alternative inside :is(), and a blanket currentColor. There is no allowlist. Type (font) stays with test_interface_fonts.py.

The reading sees every class a builder's call spells. Three routes stay outside it: a class a wrapper such as closeControl hands on from its own caller, a press a selector names by a tag other than a button (such as span.lf-margin-marker), and a class a module's own classList call adds. None of them restyles a press today. Reading the first two from the source took a wrapper and tag inference that review showed misreads cases of its own, so they are left to a check in the browser, which knows which elements are presses.

Where the looks went

  • The margin entry's face, states and pin look moved from base.css and annotation-theme.css into controls.css.
  • The response bar's choices and their frame moved from response.css onto the response role; a reaction among them is a toggle (aria-pressed) from creation.
  • Send, Dictate, Other responses, Resolve and Reopen had 14 rules keyed on each widget's class. They are now the symbol role's disc variant (data-lf-disc), with their ink set by data-lf-tone.
  • Smaller one-offs became declared variants: data-lf-corner and data-lf-bar on marks, data-lf-frame on pictures, data-lf-ahead, data-lf-band (an On list's Done heading, which is its group's band) and .lf-mark-hover on rows.
  • Each variant is named in its role's description in control-faces.js.

Margin entries take no className

A contribution entry's className option put classes on a margin entry after the role built it, where the check could not see them. Its four users were test handles or leftovers: a suggestion's Accept and Reject (lf-sug-*), a reaction's mark and its removal, and the margin's reaction choices, which wore the response bar's .lf-react. The option is gone, and tests find those entries by data-lf-margin-entry-key and data-lf-margin-entry-owner. A package that passes className now fails with "Unknown contribution entry option: className"; no bundled package does.

What looks or behaves differently

Compared with leaf-dev stills against main (66 states at desktop, 5 on a phone, 7 in the dark scheme). Every margin entry, pin, reaction and composer state is pixel-identical. Each change below makes a role draw one way where it drew two:

  • The Page Map no longer washes a thread's row green when it is your turn. Both it and Threads say "Your turn" in green at the row's end, and the thread's margin entry keeps its wash.
  • A symbol keeps its hover look while what it opens is showing, such as a playground's "…" and the passage bar's Other responses.
  • Resolve, Send and Dictate light their disc under keyboard focus, as a symbol lays its chip.
  • The panel's Done, once answered, takes the ok tone the page's Done uses, instead of a toggle's accent.
  • On a touch screen, a finger that starts on one of the margin's reaction choices can scroll the page, as it can on every other margin entry. They no longer get .lf-react's touch-action: none, which suits the response bar's row of chips.
  • The panel's reply outlet is renamed .lf-fp-reply-outlet, because its reset was stripping On me's Reply of its look.

Testing

Ran the model tests in test_interact_layer.py and test_interface_fonts.py, the runtime's Node tests, pnpm run check:browser, pre-commit, and the 45 browser tests whose locators changed, which pass (one of them only after merging the latest main, which fixed it). Two stills states were added, for the margin's reaction choices and a reaction's mark.

This was written by Claude Code on behalf of max-sixty

# Conflicts:
#	browser/runtime/chrome.css
#	dist/kernel/kernel.json
The docstring claimed the reading saw every class Leaf writes on a press.
Review showed two routes it misses: a wrapper such as closeControl that
hands on its caller's class, and a press named by a tag other than a
button (span.lf-margin-marker). A wrapper and tag inference closed both
on the current tree but misread cases of its own (several builder calls
in one wrapper, names shared across modules, quoted markup, partial
tags), so the check keeps its simple reading and says where it stops.
# Conflicts:
#	browser/AGENTS.md
#	browser/base.css
#	browser/runtime/chrome.css
#	browser/runtime/composing/input.js
#	browser/runtime/reactions.js
#	browser/styles/components/reading.css
#	browser/styles/components/response.css
#	dev/leaf_dev/commands/stills.py
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-errors.js
#	dist/kernel/runtime/bundle-page-layout.js
#	dist/kernel/runtime/bundle-restore-state.js
#	packages/timeline/defaults.css
#	packages/timeline/widgets/timeline-view.js
#	tests/js_facts.mjs
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
# Conflicts:
#	browser/styles/floating-panel.css
@max-sixty

Copy link
Copy Markdown
Owner Author

@leaf-agent The dismissal of your approval on 125df35e7 wasn't a decision by Max: it was GitHub's stale-approval rule firing when I pushed the merge of main (ebe0d603d, whose commit the dismissal records). Nothing withdrew the approval on purpose, and Max has asked for this PR to merge. Please give the current head your verdict.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit 078ad7e into main Nov 4, 2026
4 checks passed
@max-sixty
max-sixty deleted the role-face-overrides branch November 4, 2026 10:03
max-sixty added a commit that referenced this pull request Nov 4, 2026
max-sixty added a commit that referenced this pull request Nov 4, 2026
Leaf's word, symbol and committing presses, and its text fields and
selects, now take Web Awesome's design from the installed library, as
its radios and checkboxes already did. The build generates the rules
from Web Awesome's `native.css`, so Leaf no longer draws these faces
itself.

The user asked for a reasonable design from a UI library rather than
looks of Leaf's own, and asked why Leaf copied the library's rules
rather than referencing them. After seeing previews, they asked that
words keep Leaf's quiet look, through the library's own tokens.

## What changes on screen

- **Words** (`.lf-btn`, authored `.button`) keep Leaf's muted ink and
regular weight. Their side padding becomes the library's 1em, 12.5–14px,
up from 10px. Under a hovering pointer they take the library's quiet
fill, Leaf's field colour, where they took the chip and turned ink; the
words stay muted. Symbols take the same fill.
- **Keyboard focus** on a word or symbol shows Leaf's focus band alone.
Before, it also laid the chip under the press.
- **The committing press** (`.lf-btn.lf-commit`, authored
`.button.primary`) is the library's outlined button in the brand
variant: accent words under the softened accent hairline, with the tint
under the pointer, on a clear ground rather than the card's.
- **Disabled controls** fade to 0.5 with the not-allowed cursor, the
library's pair, also for a press disabled through `aria-disabled`.
surfaces.css's cue for every disabled control a widget offers moves to
the same pair from 0.55 and the default cursor, and Send and Dictate,
which keep their own muted face, take the same not-allowed hand. A
disabled commit used to have a grey face of its own.
- **Fields and selects** (`.field`, and inputs and selects with
`.lf-ui`) keep their height. Their inner padding becomes 1em, up from
8px, and a select shows the library's chevron instead of Leaf's small
drawn arrow, set in a neutral grey (the library's own grey turned violet
on Leaf's warm grounds). An authored `textarea.field` takes the
library's text box; Leaf's own text boxes, which grow with their words,
keep theirs.
- **Radios and checkboxes** look the same; the mark now changes at once
instead of over the library's 150ms fade.

## How the rules are generated

`build/styles.mjs` takes the "Checkboxes + Radios", "Buttons" and "Text
Fields + Textareas + Selects" regions of `native.css` into one generated
sheet, `browser/styles/vendor/webawesome-native.css`. That sheet
replaces `webawesome-choice.css`. For each region, a map names the Leaf
faces that the library's element types, classes and states stand for.
For example, `button` becomes `:is(.lf-btn, .button, .lf-icon-action)`,
`.wa-plain` becomes `:not(.lf-commit, .primary)`, `.wa-outlined` becomes
`:is(.lf-commit, .primary)` and `:disabled` also matches
`[aria-disabled="true"]`.

lightningcss, already in the lock through Vite and now a pinned dev
dependency, lowers the library's nesting and rewrites each selector
through the map. The rewrite drops:

- selectors that need an element no Leaf face is, such as
`input[type=file]` or `wa-icon`, and a single-choice listbox (`size`
over 1), which the library would draw as a closed select, so it keeps
the browser's face;
- declarations of type, outline and transition, since Leaf owns every
control's font (surfaces.css), its focus band and its motion. The
library's 75ms colour fades also reported a press's old colour to
anything reading it mid-fade, which a test that reads a state just set
caught;
- one value: the select chevron's cool grey becomes a neutral grey
(`LEAF_SETS`), since the library's grey blended to violet on Leaf's warm
grounds. The build fails if the library stops writing that value.

Every generated rule weighs nothing (`:where()`), as the library's own
sheet sits in its lowest cascade layer. shadow.css imports it after
Leaf's defaults for every control and before controls.css, which now
states only where Leaf departs from the library:

- quiet words;
- labels that wrap as the words around them do, and stay inline so an
arrow keeps its space ("Next unchecked →");
- fields a line tall wherever a surface sets its line (`--lf-line`), at
their own width, on the card ground;
- no hover fill under a finger;
- the chevron on the left in right-to-left text, and the platform's
control in forced colours;
- no inset hover shadow on these faces, which the layer otherwise lays
under an offered control, so a press a widget builds looks as an
authored one does;
- a symbol's grid laying out what it holds, such as the On me mark's
symbol and count.

The radio region moves from `@scope (.lf-choice, .choice)` to the same
map (`input` → `:is(.lf-choice, .choice) > input`). Leaf's `[type]`
workaround against scope proximity goes with it.

#5329, which landed first, draws each role's face only in its role's
rules and checks that no other sheet does
(`test_a_press_wears_its_role_s_face_alone`). The generated sheet is now
the second place a role's rules stand (`FACE_HOMES`): it holds the
library's part of the word, symbol and commit faces, named by their face
classes and narrowed only by states. #5329's variants (tones, discs, an
open menu's chip, a pressed commit) stay in controls.css on top of the
library's faces.

## The library's tokens off Leaf

The generated rules read Web Awesome's tokens, so a page without Leaf
that links `portable.css` drew its widgets' presses without a frame or
padding (`test_a_host_draws_each_widget_as_a_leaf_page_does`).
`portable.css` now carries Web Awesome's tokens and Leaf's values for
them at the host's root, as it carries Leaf's tokens:

- `build/styles.mjs` keeps only the theme's custom properties, its
tokens. Its root colour, colour scheme and sans and its page-frame rules
go, so base.css's rule reverting the first three goes too.
- Leaf's values for the library's tokens move from
`components/webawesome.css` into their own sheet,
`styles/webawesome-tokens.css`, which shadow.css imports where the rule
stood and `portable.css` places at the root.

## Testing

- `leaf-dev stills` against main for release-draft, trace-controls,
notification-playground, hub-choice, command-hub, plan-panel,
visual-review-gallery and command-reference-search, and trace-controls
in the dark scheme. The differences are the ones listed above. The
floating panel's filter tabs keep their one-line wrap, and plan-panel
shows no pixel change.
- A fresh reviewer read the captures and the code. Its findings are
fixed here: the doubled hover (fill plus the layer's shadow), the On me
mark's packed symbol and count, fields ignoring a local `--lf-line`, two
disabled looks, the violet chevron, a build guard for selector arguments
it can't rewrite, and stale comments. It confirmed the fixes and that a
fresh build matches the committed sheets byte for byte.
- A Firefox probe of the notification playground. A word reads muted at
rest and under the pointer, weight 400, with the field fill on hover. A
pressed toggle keeps its accent face under the pointer. The commit takes
the tint on hover. A keyboard-focused word wears the 2px accent band.
- `test_a_pressed_quiet_action_looks_like_its_neighbour` now compares
the band as well as the ground, since visible focus no longer lays a
fill, and `test_a_control_a_widget_built_is_told_from_a_label_it_wrote`
expects the not-allowed hand on a spent control. Both pass, with
`test_a_tapped_button_looks_like_its_neighbour` and the choice ring
tests; the ring tests run in Chromium and Firefox.
- `test_plain_choices_stand_one_per_line_until_the_author_sets_columns`,
`test_an_ordinary_page_is_drawn_as_written` for every plain page, and
`test_each_control_archetype_holds_its_neighbours_still` for
playground-actions, shot-view and both visual-review archetypes.
- `test_a_host_draws_each_widget_as_a_leaf_page_does`, the face checks
in `test_interact_layer.py` (with the generated sheet as a home), and
the Web Awesome typography and menu tests.
- `pnpm run check:tools`, `pnpm run check:browser` (the generated sheets
match the build) and the dependency-bundle publisher's tests. Stills
after taking the theme's tokens only show no change of colour, colour
scheme or font anywhere.

## Known weaknesses

- lightningcss 1.33's visitor hands optional fields over as `null` and
refuses them back, so the build strips nulls before returning a rule.
- The generated rules weigh nothing, so a theme package's element rule
(`button { … }` in its defaults.css, which comes after Leaf's sheet in
the same layer) now restyles Leaf's presses in the page, where Leaf's
class-weight faces used to win. No bundled or installed theme has such a
rule.
- A host that uses Web Awesome itself now gets Leaf's values for the
library's tokens at its root, below its own unlayered theme, which
outranks them.
- `LEAF_SETS` swaps one literal colour in the library's output; a
library update that redraws the chevron in another grey fails the build
until the entry is updated.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 4, 2026
Conflicts, resolved:
- Thread to-dos: main took a thread's to-dos and their Done away (#5331), and this
  branch had moved them into ThreadView. They go from ThreadView, its commands and
  surfaces.css, with the panel's inset rule for them; the quote stays.
- The panel's ✓: main gave its own Resolve button a disc and a tone (#5329); the
  panel's ✓ is ThreadView's on this branch, which already has them.
- floating-panel.css: main renamed the reply's outlet to `.lf-fp-reply-outlet` and
  dropped the Threads row's mark wash; this branch dropped the panel's quote rules
  and the reply part's wrapper. Both removals stand.
- Tests: main's new held-news test and rewritten `z` reply test stand beside this
  branch's renamed drawn-commit test and selectors.

`test_a_resolve_s_notice_stands_for_that_resolve_alone` expected the notice's Undo
to show a gesture the agent had picked up before taking it back, the rule #5320
removed; main never reached that step, since its Resolve went back to Threads
there (fixed on this branch). It now expects the press to take the Resolve back.
max-sixty pushed a commit to max-sixty/tend that referenced this pull request Nov 5, 2026
… the author's (#1650)

Where a repository's rules dismiss stale approvals, GitHub dismisses the
bot's approval on every push and names the pusher as the
`review_dismissed` event's `actor`. Nothing in the review skill said how
to read that event, so a review session took it as the author
deliberately withdrawing the approval and withheld its verdict on the
new head (max-sixty/leaf#5329, where the maintainer had to ask for the
verdict). The review skill now says how to tell the two apart under
**Pre-flight checks**: an automatic dismissal records
`dismissed_review.dismissal_commit_id` and a null `dismissal_message`; a
person's dismissal carries their message and no dismissal commit. After
an automatic one, the session reviews the new head as usual.

I checked the distinguishing field against live timelines. The leaf#5329
event has `dismissal_commit_id: ebe0d603…` and `dismissal_message:
null`. Every API dismissal on this repo's PRs (#1544, #1480, #1346) has
a message and no `dismissal_commit_id` key. Those are the bot's own
dismissals. I found no dismissal made through the web UI to compare, but
GitHub requires a message for those too. No model eval was run: this
adds one fact about GitHub's data to the skill and changes no decision
rule.

Closes #1649 — automated triage

Co-authored-by: tend-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…ssName (#5535)

`test_an_acknowledgment_uses_status_until_an_active_claim_restores_a_disclosure`
has failed on main with `Unknown contribution entry option: className`
since #5329 (078ad7e), not #5336 as the issue's bisect concluded.
#5336 changed only `browser/runtime/chrome.js`. #5329 deliberately
dropped `className` from contribution entries ("Margin entries take no
`className`" in its description) and moved its tests to
`data-lf-margin-entry-owner` / `data-lf-margin-entry-key`, but it missed
this test's pickup-carrier probe. The two commits landed a minute apart,
which is probably why the bisect pointed at the wrong one.

The probe now registers its entry without `className`, and the test
finds the carrier by owner `workflow-primary-probe` and key `edit`. The
assertions are unchanged, so the test still covers what it protected: a
semantic action carries pickup, and removing it brings back the status
marker. Nothing in the product changes.

Verification: the test fails on current main with the reported error and
passes with this change (`uv run pytest
tests/browser/margin/test_status.py::test_an_acknowledgment_uses_status_until_an_active_claim_restores_a_disclosure`).

Closes #5482 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 5, 2026
#5329 removed the margin entry's `className` option, so a suggestion's
Accept and Reject in the margin no longer carry `.lf-sug-accept` /
`.lf-sug-reject`. That PR moved the other tests to
`data-lf-margin-entry-key`, but
`test_a_widget_naming_its_own_words_does_not_read_the_runtimes` still
clicked `.lf-sug-{outcome}` and timed out waiting for it. It now finds
both controls by `[data-lf-margin-entry-key={outcome}]`, the same way
the rest of `test_suggestions.py` does. No product behavior changes, and
#5329's intent is unaffected.

Locally the test fails on `main` (`Locator.click: Timeout … waiting for
locator("[data-lf-margin-for='sug'] .lf-sug-accept")`) and passes with
this change. No other test in `tests/` or `dev/` still names
`.lf-sug-accept` or `.lf-sug-reject`.

Closes #5483 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 8, 2026
…ne (#5696)

This removes four pieces of code nothing reads and corrects comments, a
test docstring, a note and an eval rubric that name things since renamed
or removed. The one change that affects a result is the
`shared-contribution-actions` rubric: it accepted `className`, an entry
option the runtime has refused since #5329, and failed answers that use
`action` or `voice`, which `ENTRY_OPTIONS` accepts. It now lists exactly
the entry options, and a runtime test
(`tests/runtime/contribution-entry-schema.test.mjs`) fails when the
rubric's options, behaviors, tones, ranks or states differ from
`CONTRIBUTION_ENTRY_SCHEMA`, which now also lists the entry options
under `options`. Nothing else changes at runtime.

Dead code:
- `buttonReadings` / `buttonCommand` in `keyboard/scopes.js`. The map
was still filled on every button reflection, but #5638 moved its two
runtime readers (command hints and control keys) onto `reachingNow`.
Five asserts in `tests/runtime/command-controls.test.mjs` read it. Each
of those tests still asserts the button's `aria-disabled`, and where it
presses the button, what the press runs.
- `publishing()` on the application in `framework/application.js`, which
has no caller.
- A second `aria-label` write on the command reference's close control.
`closeControl` already writes that label through `roleElement`.
- `PredecessorReading.committed_active` in
`validation/source_history.py`, which no reader uses. The local variable
of that name still picks the predecessor.

Stale references:
- `undo.js` says a Resolve offers Undo, but since #5630 a Resolve offers
Undo only when it leaves no thread open.
- `traffic.js` says `sends` and `acked` count only `/api/event`, but
they also count `/api/media` uploads.
- `lf-call-diff.js` names `setChildren`; rows are placed with
`setChildLists`.
- `margin-layout.js` and `annotation-theme.css` name `seatRows`, which
is now `seatRow`.
- Three `chrome.css` comments name `foldOut` and `msgNode`, which no
longer exist, or describe a rule that no longer follows them.
- A `tests/browser/margin/test_entries.py` docstring names
`syncInlineOffers`, which no longer exists.
- `notes/feeds/README.md` linked the closed #4058 as open work. It now
points at the `notes/threads.md` section that issue's closing comment
named.

Verified locally:
- `pnpm run test:runtime`: 898 pass. The new test fails when `className`
is put back in the rubric.
- `tsc -p browser/types/tsconfig.json`.
- `pnpm run check:browser` and `pnpm run test:browser`.
- `tests/model/test_interact_document.py` and
`test_interact_anchors.py`: 308 pass.
- pre-commit on the changed files, including knip, eslint and
dependency-cruiser.

Found by the nightly survey and review of recent commits. Two findings
are left out on purpose:
- `data-lf-go-to-active` has lost its only stylesheet reader (#5637),
but ten tests and `dev/leaf_dev/states.py` use it as the signal that the
sequence is armed.
- The developing-leaf glossary still names `seatRows`. It sits under
`.claude/`, which needs the control-plane owner's approval.

---------

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants