Skip to content

Fix the cascade fights behind Leaf's !important rules - #4302

Merged
max-sixty merged 4 commits into
mainfrom
important-audit
Oct 27, 2026
Merged

max-sixty merged 4 commits into
mainfrom
important-audit

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Most !important declarations in Leaf's own CSS beat another Leaf rule, not the page. Each one now gets its fix where the conflict comes from, or a comment saying why it stays.

Removed, with the cause fixed:

  • Draw mode no longer gives Leaf's controls in the page the crosshair and then takes it back with cursor: auto !important. The crosshair rule skips [data-lf-runtime] surfaces, so their buttons now show their own pointer cursor rather than the arrow.
  • .lf-shaped follows the aim box it shapes, so it wins on order. paintAim writes a 0 corner for a shaped aim, as the trace and visual marks already do.
  • The composer's quote, which only supplies the field's description, carries hidden. That replaces two important rules that hid every other composer child.
  • An away block control is hidden (via keepsHidden) rather than a class with its own important display rule. Leaf's [hidden] already beats any display.
  • The pane role's display: grid moves from lf-layouts to lf-base, beside the pane's look. A widget can now hide one of its own panes with an ordinary rule. This lets Visual Review's existing rule hide a case's empty discussion, which the Layout tier had overridden. Paper still drops the Visual Review navigation, now without importance.
  • Shot's per-mode geometry (compare, flip, pixels) is screen-only, so its print rules no longer need to beat it.
  • In the diff, the head's pull-up beside the action bar is screen-only. The print rule that zeroed it and an override that had no effect are gone.
  • Rules that had nothing to beat drop it: the fab hide, the inline response bar on paper, the raised-margin hide, margin markers on paper, a visual mark's background, and the diff filter.

Kept, each with its reason in a comment: the startup layer and [hidden] in the theme and shadow trees; reduced motion; forced colours; the iOS text-field floor; paper's controls (state.css) and threads (controls.css); the root and body against page styles; draw mode's crosshair; options' until-found collapse and the quoted playground against authored styles; a code block's lines on paper against the reader's inline wrap choice; lf-ask's ring overlay against the unlayered chrome ring; the render check's wrap probe.

Computed styles for every element match the merge base in screen, draw mode and print on 16 corpus pages, and across the shot modes. The exceptions are the two intended changes: the cursor on Leaf controls during draw mode, and the empty Visual Review discussion.

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

max-sixty and others added 2 commits October 26, 2026 10:10
Most `!important` declarations in Leaf's own CSS beat another Leaf rule, not the
page. Each one now gets its fix where the conflict comes from, or a comment
saying why it stays.

Removed, with the cause fixed:

- Draw mode no longer gives Leaf's controls in the page the crosshair and then
  takes it back with `cursor: auto !important`. The crosshair rule skips
  `[data-lf-runtime]` surfaces, so their buttons now show their own pointer
  cursor rather than the arrow.
- `.lf-shaped` follows the aim box it shapes, so it wins on order. `paintAim`
  writes a 0 corner for a shaped aim, as the trace and visual marks already do.
- The composer's quote, which only supplies the field's description, carries
  `hidden`. That replaces two important rules that hid every other composer
  child.
- An away block control is `hidden` (via `keepsHidden`) rather than a class with
  its own important display rule. Leaf's `[hidden]` already beats any display.
- The pane role's `display: grid` moves from `lf-layouts` to `lf-base`, beside
  the pane's look. A widget can now hide one of its own panes with an ordinary
  rule. This lets Visual Review's existing rule hide a case's empty discussion,
  which the Layout tier had overridden. Paper still drops the Visual Review
  navigation, now without importance.
- Shot's per-mode geometry (compare, flip, pixels) is screen-only, so its print
  rules no longer need to beat it.
- In the diff, the head's pull-up beside the action bar is screen-only. The
  print rule that zeroed it and an override that had no effect are gone.
- Rules that had nothing to beat drop it: the fab hide, the inline response
  bar on paper, the raised-margin hide, margin markers on paper, a visual mark's
  background, and the diff filter.

Kept, each with its reason in a comment: the startup layer and `[hidden]` in the
theme and shadow trees; reduced motion; forced colours; the iOS text-field
floor; paper's controls (state.css) and threads (controls.css); the root and
body against page styles; draw mode's crosshair; options' until-found collapse
and the quoted playground against authored styles; a code block's lines on paper
against the reader's inline wrap choice; lf-ask's ring overlay against the
unlayered chrome ring; the render check's wrap probe.

Computed styles for every element match the merge base in screen, draw mode and
print on 16 corpus pages, and across the shot modes. The exceptions are the two
intended changes: the cursor on Leaf controls during draw mode, and the empty
Visual Review discussion.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
# Conflicts:
#	browser/runtime/annotation-overlay/annotation-chrome.css
#	browser/runtime/chrome.css
#	browser/styles/chrome.css
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
@max-sixty
max-sixty merged commit bec2f8d into main Oct 27, 2026
4 checks passed
@max-sixty
max-sixty deleted the important-audit branch October 27, 2026 02:05
max-sixty added a commit that referenced this pull request Oct 27, 2026
Main's #4302 moved the pane's box into the base tier, so the visual
review's empty-discussion hide needs no important declaration; this
merge keeps main's plain rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
#4302 dropped `!important` from the print rule hiding an inline response bar,
counting it among rules with nothing to beat. It had one: the rule showing an
open bar (`.lf-fab-bar:is([data-lf-target-only], :has(> .lf-composer[data-lf-open]))`)
outranks it on specificity, so a comment field open in a widget's thread seat,
such as an lf-diff line's, printed on paper. main fails
test_a_data_bound_diff_aims_and_selects_one_source_line the same way.

The rule that shows the bar now applies on screen only, and the print rule is
gone: paper keeps the bar's resting `display: none`, as the chrome holding the
floating bar already prints nothing. This restores the behavior before #4302:
an open inline composer does not print.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
A follow-up to #4302, from a second review of the `!important` rules it
kept. Two more go, and draw mode's crosshair becomes one rule instead of
two. Nothing visible changes.

- **Quoted playground.** `initial/lf-playground.js` sets `hidden` on a
quotation's controls, its presets and the boxes that held only controls.
Leaf's `[hidden]` rule already beats any display the page states, so the
important class rule in `widgets.css` and its
`lf-playground-control-box` marker are gone.
- **Forced colours.** The Leaf mark's state tones are
`.lf-dot:where(.working)` and so on, which match the same elements as
`.lf-dot.working` but add no specificity. The forced palette's later
`.lf-dot` rule now replaces every tone on order, without `!important`.
- **Draw mode.** `integration.css` already reached shadow trees through
a style query on `--lf-draw-mode`. That sheet also reaches the document,
so dropping `:host` from its selectors lets one rule serve both, and
`chrome.css` keeps only region capture's crosshair.
- **Comment.** The startup layer's comment in `theme.css` now says the
layer is first inside `lf-base`, not first in the theme.

Computed styles for every element, shadow trees included, match main on
13 corpus pages in Chromium and 3 in Firefox, in screen, draw mode and
print. The mark's tones match under forced colours. The
quoted-playground and draw-mode browser tests pass, apart from
`test_draw_mode_leaves_chrome_controls_usable`, which times out waiting
for `.lf-fp-on-user` on main too.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
#4323)

UI defects kept reaching the user one screenshot at a time because
nothing judged a change the way its user would, and Leaf let each widget
choose its own control faces. This branch narrows Leaf's control
vocabulary to one face per role, removes 22 things shown at rest that no
task needed, and makes a UI review use the change before reading its
code. The user picked each removal from proposals with captures on a
Leaf page.

### Controls are built by role

A widget names a role and never a face's classes: `offerAction(role,
className, label, {title, icon})`, or `offeredAction(…)` in a template,
from `widget-api.js`. The four roles are `symbol`, `word`, `commit` and
`mark`. Their face classes are spelled once, in `ACTION_FACES` in
`browser/runtime/prepaint.js`, and
`test_controls_are_built_by_role_and_never_by_face` fails when any other
bundled module spells one. Every runtime and package control is cut
over, including controls main added while this branch was open (the
Other responses trigger, the playground's instruction bar, page
diagnostics).

Symbols and worded buttons are quiet until hovered or reached by key;
only the committing press keeps a frame, in the accent. The word role
absorbs the old item role. `module-authoring.md` lists the roles for
package authors, and says a control shows a symbol only where a standard
one for its action exists.

A pressed quiet button no longer keeps its hover chip, and a tapped
button no longer keeps its hover face on a touch screen: hover faces
apply only where a pointer hovers.

### Removed at rest

The twelve clear cuts from the surface audit, nine of its judgment
calls, and the panel seat's agent-message count:

- Panel and threads: an untitled thread view's repeated heading; "New"
on unread rows in Threads; the seat's "2 agent messages in 2 threads"
(now announced only); the widget kind on On me cards; a message's age
where it repeats the one above; the "Chose X — sent" notice (announced
only).
- Decisions: the § reference where all rows point at one block; the "✓
selected" chip on a picked card; the option count on a settled decision.
- Queues: "To answer" under rows the user owes.
- Diffs: the filter bar on a one-file diff; the open reply field under
each conversation, which now rests as a one-line Reply that click, Tab
or `c` opens; "Changed" on worktree rows.
- Evidence: the trace timeline's legend line; four of the five places a
trace showed its playhead time; the count in "Moments (3)"; a
visual-review case's empty discussion box, its "Unchecked" label and its
long capture caption.
- Playgrounds and samples: the "Controls" and "Starting points" labels
(kept as accessible names); "LIVE SAMPLE ·" and "INTERACTIVE SAMPLE ·"
captions (quoted samples keep "QUOTED ·").

Each module whose header recorded the old behavior as a product choice
now records the new one and the alternative it replaced.

### Alignment

Option titles line up across a row whatever chips a card has, a row of
metric tiles sets every figure on one line, and a board card's prose
starts on its title's next line in every shape. Where chips wrap,
Chromium still sets that title lower; `authoring-on-me.md` now asks for
labels of a word or two, and the `options-label-what-sets-them-apart`
eval gained a `labels-fit-one-line` metric (both arms 3/3;
`facts-labelled` 1/3 → 3/3).

### Review and tests

- `developing-leaf` states the review a UI change gets in place of the
`/ui-sweep` line sessions skipped: use the live change for the user's
task by every route before reading its code, judge each control against
its neighbours, and keep appearance in any reviewer's brief. Fresh
sessions writing a reviewer brief asked for that on 3 of 3 runs with the
new text and 0 of 3 with the old.
- The shift watch credits a sticky box's animated inset only by its move
within its block. Box-motion's ride animates sticky heads' `top` against
the carry, and the watch read that as an offset;
`test_send_grows_thread_around_the_words` failed at random on main too.
- The stills catalogue gains states for the timeline, Threads, a pick's
notice, option references, the visual review, a picked card, a settled
option and an interactive sample.

### Two regressions from main, fixed here

- Main's #4270 read an option's computed `display` while lf-options
rendered, forcing a Firefox layout mid-render that drops a card's
baseline shift, so one card's title sat 44px low. The option's
consequence is now read only when On me, the command reference or a
touch menu shows it (`notes/browser-support.md` records the Firefox
behaviour).
- Main's #4302 dropped `!important` from the print rule hiding the
inline response bar, which a more specific rule then beat, so an open
comment field printed. The rule that shows an open bar now applies on
screen only.

### Behavior changes in tests

Tests that asserted removed words or framed faces now assert their
absence; the worktree column and playground region tests were adjusted
for rows without a status word and a rail without labels; the trace
journeys read each playhead fact from its one label; a side-list Back
check that main's #3998 superseded is removed. Each commit message names
the behavior it changed.

Focused tests for each change, `pnpm run test:runtime` (668) and `pnpm
run check` pass locally; the broad suite runs here.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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