Skip to content

Give reactions, inline presses and list rows one face each - #4652

Merged
max-sixty merged 19 commits into
mainfrom
canonicalize-element-faces
Oct 29, 2026
Merged

max-sixty merged 19 commits into
mainfrom
canonicalize-element-faces

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A survey of Leaf's controls found several presses that drew their own look where a canonical one existed: reactions the user added, accent text presses among words, and the rows of every list. Each now wears one face, chosen from side-by-side candidates on a review page. The faces are roles in ACTION_FACES (browser/runtime/prepaint.js), drawn in browser/styles/components/controls.css.

Reactions the user added

A reaction the user added, .lf-react[aria-pressed="true"] outside the margin, takes the accent ink, an accent border and --accent-tint. Under the pointer or keyboard focus this deepens to a 24% accent mix. Before this, a pressed reaction differed from an unpressed one only by a faint chip. Margin reactions keep the margin-entry look.

The inline role

The new inline role, lf-inline-action, is a press set among words. It draws accent ink at weight 600 and line size, underlined only under the pointer, and data-lf-news turns it danger red. It replaces the separate looks of:

  • the held-news notice on thread cards and in the activity feed;
  • the floating panel's Next unread;
  • Full quote;
  • a thread's disclosures, such as a progress run's "N steps".

A card's held news now fits the head's room (#fitMarginNews in thread-card.js, newsNotice in held-news.js). Where the room is too small, the notice shortens to "+N" or "N new". Room in the head goes first from annotations, then from the author's name, and never from the time (#3104). A cut name keeps its gap before the time, using a transparent border, so its ellipsis never runs into the time.

The row role

The new row role, lf-row, is one row of a list or menu. A row is square in every state and washes with --offer-hover under the pointer. The current row (aria-current or aria-selected) gets --accent-tint and a 2px accent stripe at its start. The role is used by:

  • the panel's menu, Versions, Threads, On me and All pages;
  • both Back presses, now drawn as one press;
  • the Page Map;
  • lf-timeline, through a new last argument to selectableOffer*;
  • lf-trace;
  • visual review's cases.

Supporting changes

  • Contract. skills/leaf/references/module-authoring.md lists the two new roles.
  • Tests. test_interact_layer.py holds the role list to the code's copy. New margin tests cover the order in which a head gives up room, and the name's gap before the time. The reopened-picker test in test_render_reactions.py asserts the new pressed face.
  • Stills. dev/leaf_dev/commands/stills.py gains the states these faces need.

Most of the remaining diff is the rebuilt kernel under dist/kernel/ and the vendored first-render files of the packages.

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

A reaction the user added wore the same grey chip and contour as a choice under the
pointer, so in the open palette yours and a hovered neighbour looked alike, and pointing
at your own changed nothing. It now rests on the accent tint inside an accent contour,
and the tint deepens under the pointer or focus, as an idle choice's chip rises. The
user picked this face from three candidates on the canonical-element-faces page.
Margin reactions keep their own family's face.

The reopened-picker test now holds the contour constant through opening, hover and
focus, and expects the tint to answer the pointer; it previously asserted that hover
changed nothing.
…thor beside held news

Four presses sit in a line of words and each drew a face of its own: a
thread's held news (bold 10px, danger red), the activity feed's notice
(underlined at rest), the floating panel's Next unread (body weight, a grey
wash under the pointer) and a retained quote's Full quote (muted 12px, a
wash). They are now built by a fifth control role, `inline`, beside symbol,
word, commit and mark (`ACTION_FACES`, prepaint.js), whose one face lives in
controls.css: the accent ink at weight 600 and the size of the line the
press sits on, no chip, fill or border, underlined (offset 3px) under a
hovering pointer. A press announcing news waiting carries `data-lf-news`,
which the face draws in the danger ink, as it does the words a seat's
Resolved summary says its threads hold. The progress run's "Show N progress
messages" disclosure shares the class with Full quote and takes the face.

What changed for each:
- Held news: 600 at the head's line (`--t-6`, 11.5px) instead of 700 10px;
  in the panel's crumb it takes the crumb's 13px on a line an em tall, so
  its arrival still grows no line.
- The activity feed's notice: no underline until hovered. The feed states
  its line (`--t-5`, sans) once, on `lf-activity`, and the notice inherits it.
- Next unread: weight 600, no wash; it keeps its symbol, padding and height.
- Full quote: accent 13px (the quote's size) instead of muted 12px; no wash.
- The steps disclosure: 11.5px (its head's size) instead of 11px.
Each surface's colour, size, weight, decoration and ring rules for these
presses are gone, keeping only placement; `.lf-thread-notice` and
`.lf-thread-notice-news` no longer exist.

A margin card holding news cut the head of the user's message to "M51d ago":
the notice, drawn whole in the actions row, left the heads' track 41px. The
notice now takes at most the room a notice beside a head's words takes in a
primary reader (`--lf-news-width`, renamed from `--lf-primary-news-width`),
drops the facts past it and counts them, so the card reads "Me 51d ago
1 new reply +1". The count stands just past the last fact shown rather than
at the room's end, so it reads with the words, and its room is in the
notice's own size. Rejected: the time giving way while news waits, which
frees 43px, too little for a name beside a whole notice; and the notice
wrapping beneath the actions, over the first message's words. A phone's
320px card is still too narrow for the user's name beside its Edit control,
three 44px controls and the notice's first fact.

`floating-thread-unread` (and `-dark`) is a new stills state that offers
Next unread. `test_a_card_s_head_keeps_the_user_s_name_and_time_beside_news`
is new and fails on the base with the time cut; tests and stills that found
the notice by `.lf-thread-notice-news` find it by `.lf-thread-news`.
…for its first fact

On a phone's margin card holding news, the head of the user's message still
read "M51d ago": the notice stood at a notice's room (`--lf-news-width`)
whatever the head beside it needed. A margin card now measures that room: the
notice's width and the narrowest head's width beyond its padding, name, gap
and time, which the actions' track and the heads' track trade one for one
(thread-card.js, `#fitMarginNews`, `--lf-news-room`), watched as a time ticks
on. The notice takes no more.

Where even its first fact would be cut, the notice now says one count of all
that waits instead, "2 new", or "+2" where that doesn't fit either
(`data-lf-short`). The existing drop-and-count observer decides it from the
cut it already reads; the facts keep their places, unseen, so what it measures
doesn't change with what it shows and the accessible name still says every
fact. The count is the sum of the news's counts, a settling counting as one,
measured with the runtime's `textWidth`.

A desktop card is unchanged: the room is wider than a notice's, so it still
reads "Me 51d ago  1 new reply +1". A 320px phone card can't hold the head's
name, time and Edit beside three 44px controls and a 44px notice, so its
heads now give up the time before the name: annotations, then the time, then
the name, each with an ellipsis. That reverses #3104's order, in which the
time was never cut; the phone card reads "Me 5… ✎ 2 new".

`test_a_card_s_head_keeps_the_user_s_name_beside_news` now runs at a desktop
and a phone width; the phone case asserts "2 new" and "Me" whole.
27f92a8 had a margin card's head give up its time before its name. This
restores #3104's order: the annotations after the time first, then the
name, and the time is never cut. The defect was the notice drawn over the
head, which the notice's fitted room and its one count fix by themselves. A
phone's 320px card now reads "M 51d ago ✎ 2 new": the notice stands clear of
the head and the time is whole. Beside a finger-wide Edit, the name has no
content room left, so its first letter shows cut in its padding.

The margin card refits its notice's room when a head's time changes size,
in the next frame rather than inside the size observer's delivery, and
watches only the times, whose size the fit doesn't change. Fitting inside the
delivery resized boxes the delivery had already passed, which Chrome reported
as "ResizeObserver loop completed with undelivered notifications".

`test_a_card_s_head_stands_whole_beside_news` (renamed from
`…_keeps_the_user_s_name_beside_news`) now asserts on a phone that the
notice says "2 new" and stands clear of the head, the time stands whole and
clear of the Edit, and the name is cut with an ellipsis.
# Conflicts:
#	browser/styles/components/surfaces.css
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/widget-api.js
…e news count

A phone's margin card holding news read "M51d ago": the name, squeezed to no
room, kept the gap before the time as its own padding, so a sliver of its first
letter stood in the gap against the time (main's desktop card showed the same).
The gap is now the time's: the metadata carries it as padding, with its ground
over it as the name's was, so a name cut to nothing takes no box and the time
starts clean. Where a head the notice still leaves short would show less than an
em of its name, which is a sliver of a letter or of the ellipsis, the margin
card's fit gives the name no width (`data-lf-nameless`, thread-card.js). #3104's
order holds: the annotations, then the name, and the time is never cut. The
phone card reads "51d ago ✎ 2 new".

The fit reads a head's words at the fraction of a pixel they are laid out at,
from a range, rather than by scrollWidth, which rounds a whole name and counts a
cut one's ellipsis; a 0.3px shortfall had left a desktop head reading "M…".

The notice's counts, "+1" past its facts and the one count that replaces them,
stand out of the words' flow, so the face's underline under the pointer
stopped at the facts and "+1" read as something apart. They now inherit it
through the words. The one count hides the facts by visibility rather than by
a transparent colour, so the underline they still carried isn't drawn under
nothing; the title names the press while they are hidden.

The phone case of `test_a_card_s_head_stands_whole_beside_news` now asserts
that the name takes no box. Its desktop case no longer asserts the notice's
full facts: since main gave a head's Copy and Edit their room, the desktop card
says one count too.
# Conflicts:
#	dist/kernel/kernel.json
816f796 moved the 8px gap before a margin head's time from the name's padding to
the metadata's, so a name squeezed to nothing would leave no sliver of its first
letter there. The name's ground spans that gap so an annotation rising under the
head never shows through it, and
`test_a_stuck_card_head_keeps_the_name_and_lets_its_annotations_scroll_out`
checks that the gap reads as the name: with the metadata holding it, the point
left of the time hit the metadata, and the test failed in both widths. The
annotations themselves still scrolled out ("edited" moved 6px with the reply's
first line).

The gap is the name's again. A name the margin card's fit leaves less than an em
(`data-lf-nameless`, thread-card.js) now draws its letters transparent as well as
taking no content width, so the gap keeps the name's ground and shows no sliver:
a phone's card holding news still reads "51d ago ✎ 2 new". The phone case of
`test_a_card_s_head_stands_whole_beside_news` asserts the nameless name's letters
are transparent rather than that its box is empty.
…accent

Seven lists drew their rows six ways: the floating panel washed its rows in a 5% ink,
the command reference laid the word chip under its row, the Page Map darkened the
chip with 8% ink, a timeline step and a visual-review case took the generic offer
shadow, and a recording's moments took the word chip. The current row had four
faces: weight 600 in Versions, accent words on the accent tint for a recording's
moment, a 4% ink wash with an ink underline for a visual-review case (close enough
to its own hover that the two read alike), and the accent stripe on the tint for a
timeline step. The `word` role claimed to cover a row of a list or menu, but no row
wore it, and its muted ink would have dimmed every label.

A fifth role, `row` (`lf-row`, controls.css), draws them all: the label in the ink at
the list's own type; under the pointer or the keys (`data-lf-focus-visible`, or a
listbox's `aria-selected`) the offer's wash, now the token `--offer-hover`, laid over
the row's own ground as an image so a list's tint shows through; and the row the list
stands on (`aria-current`) on the accent tint with a 2px accent stripe at its start,
square-cornered. Every row keeps the stripe's room as a transparent border, so the
wash never hides the stripe and marking the current row moves no words. The user
picked this face from candidate captures (chip hover with stripe, wash hover with
weight, and this mix) on 28 October.

Moved onto it, each surface's own hover and current rules deleted:

- The floating panel's menu, Versions and Threads rows, On me's item lines, All
  pages' links, and the menu's Back. Versions marks its current row's press with
  `aria-current` (`menuItem`'s `current`) rather than weight; the wrapper keeps
  `data-current`.
- The view's Back is a row too, so both Backs are one face: chevron and destination
  in the ink with the row's wash. It reaches out past its words by its padding and
  the stripe room, so its words stay where they were.
- The command reference's rows (on the row, not the stretched button) and the Page
  Map's presses; a Page Map status keeps the stripe room so its words share the
  presses' edge.
- lf-timeline's steps, through `selectableOfferElement`'s new optional fourth
  argument, the action role whose face a selectable press wears; lf-trace's saved
  moments; visual-review cases, which stay square since a rule parts them.

Each list keeps what is its own: Threads lights a thread's passage under the
pointer (`.lf-mark-hover` still replaces the wash there), a timeline mutes the steps
still ahead, and the Page Map tints a thread on the user's turn with the wash over
it. Rows padded 2px less at the start where they had no border before, so words
stay put; a recording's moment gives back the 1px all round the word face's border
kept.

`selectableOffer`/`selectableOffered` and the TS declarations take the face role;
module-authoring.md lists `row` and drops the word role's claim to rows.
`test_no_rule_rounds_a_box_edged_on_one_side` now treats a transparent side as no
stripe, since it draws no edge; the room every row keeps is one.

Visible changes beyond the unification: the panel's hover wash is 7% ink where it was
5%; a disabled menu row (Undo with nothing to undo) dims by the offer's 0.55 opacity
rather than the panel's 72% ink; Copy Leaf version and Copy link read in the ink
rather than `--ink-2`; a recording's current moment reads in the ink rather than the
accent.
The row face rounded its wash but squared its current row, as the visual grammar
requires of a striped box, so where a hovered row sat under the current one the
two fills met with a notch (a recording's moments, a visual review's cases), and
a visual review's hover was square besides. A row is now square in every state,
the Page Map's and All pages' rows included, so rows stack edge to edge. In the
panel's menu the square wash stands 6px inside the menu's rounded corners, which
reads as a band across the list rather than a box on it. A timeline step's wash
now runs the step's full width square at both ends, as its current step does.

The two ways back were two shapes: the view's hugged its words and the menu's ran
the menu's width, with their words 4px apart. Both are now one press
(`:is(.lf-fp-back, .lf-fp-menu-back)`): as wide as their words, since a view's way
back shares its line with the thread's facts and presses and so can't run the
panel's width, and in the menu that width says the press leaves the list rather
than standing in it. Each holds its chevron 8px into its wash with 4px before the
words, so the menu's starts on its rows' edge and the view's reaches out by those
8px to start on the view's words. The menu's way back drops `.lf-fp-item` and its
label wrapper.

A visual review's case keeps 6px between the stripe and its numeral, as the panel's
rows do; it had 2px.
…faces

# Conflicts:
#	browser/runtime/floating-panel.js
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	packages/default/styles/activity.css
In a margin card held to 236px the head of the user's message read "M…just now",
the ellipsis flush against the time. The browser keeps a cut name's first letter
and draws the ellipsis after it even where the name's words have no room for both,
and the name's clip stood at its padding box, where the gap before the time was
its padding. The gap is now a transparent border instead: the name's ground still
spans it, so an annotation rising under the head stays hidden and the scroll-out
test still finds the name in the gap, and the clip stops short of it, so nothing
of the name is drawn there.

"M…" takes 23.2px at the name's size, and that head leaves the name 9.6px beside
the time (never cut) and the room its Copy and Edit keep, so it now reads
"M  just now", the first letter whole but for its last pixel and no ellipsis.

With the clip at the words' edge a nameless name no longer needs transparent
letters; its box gives its words no width.
`test_a_cut_name_leaves_the_gap_before_the_time_clear` holds the gap unpainted in
that 236px card and fails with the gap as padding; the phone case of
`test_a_card_s_head_stands_whole_beside_news` asserts the nameless name's words
have no width.
…faces

# Conflicts:
#	browser/styles/floating-panel.css
#	dist/kernel/kernel.json
…faces

# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name-hiding state survives after held news is revealed, leaving the original message without its author on a phone. The inline suggestion clears that state when the notice is released.

Comment thread browser/runtime/thread/thread-card.js Resolved
The fit that hides a squeezed name (data-lf-nameless) wrote the mark on each message head, and releasing the notice cleared only the notice's room. A message's head outlives the notice, so after the user showed the news on a phone's card, the user's own name stayed hidden until the card was fitted again. Releasing the fit now clears both.
@max-sixty
max-sixty merged commit 0f716e4 into main Oct 29, 2026
5 checks passed
@max-sixty
max-sixty deleted the canonicalize-element-faces branch October 29, 2026 05:37
max-sixty added a commit that referenced this pull request Oct 29, 2026
Main's #4652 fits a margin card's held notice of news to the room the heads
leave beside each name and time, counting the Edit a head kept room for in its
padding. Here a head's controls are a group in its row, so the fit counts the
group, and the rule parting a first message's controls from the thread's
stands past the head's end rather than the group's, which a card short of room
lets run past the head.

A head too narrow for what it holds now cuts it a gap past its end again, as
main's clipping head did, but only at that end, so its controls' rings and a
finger's reach still stand above and below it. A later message's head keeps to
the first track while it sticks on the actions' line, with the cell beside it,
so nothing it holds runs under a narrow card's actions.

The progress-disclosure test now checks what each head on the actions' line
shows rather than every head's box, since a later head below that line runs to
the card's edge. Its 311px touch case fails on main too.
max-sixty added a commit that referenced this pull request Oct 29, 2026
#4652 landed the face work squashed, without the press check. The merge takes main's
tree and lays this branch's changes over it: the press reader (tests/js_facts.mjs and
its parse5 dependency), `PRESS_FAMILIES` and its test, the presses the check moved
onto roles (the board's destinations, the playground's Copy, the margin entry host's
class), and round one's panel, feed, file editor and grip presses. Versions' Showing
now ends where Compare's words do, inside the word face's padding.
max-sixty added a commit that referenced this pull request Oct 29, 2026
…ys on the left (#4684)

Leaf's lists drew their rows seven ways: Threads, the page menu,
Versions, On me, the Page Map, a timeline's steps, a recording's Moments
and a visual review's cases each had their own grid, gaps, padding and
room for a mark. Now that the row face has landed (#4652), this gives
every one of them one shared layout, next to the face in `controls.css`.

### The shared layout

- **Parts.** A row names up to three parts: `.lf-row-lead` (a dot,
symbol, number or time), `.lf-row-main` (the name) and `.lf-row-end` (a
status, time, key or arrow). The lead is muted and centred on the name's
first line, and its numbers end together. The end is muted, a step
smaller, and sits on the first line's baseline. Every row has the same
padding, is at least 30px tall, and reaches the aim floor under a
finger.
- **Lists.** A list's rows (`.lf-rows`) share its columns through
subgrid, including rows held in wrappers, so names start on one edge and
are cut at one edge.
- **Scope.** Only a row that names its main part takes this layout. The
two Back presses keep their own, and so did the command reference until
its own change below.
- **Rows that aren't presses.** A Page Map status, which offers nothing
to press, lays out as a row through `.lf-row-plain`. Threads' Resolved
heading now uses the row role, so it is square on hover like the threads
beside it.

The per-list grids are deleted. Excluding generated files, the change is
+253 / −247, and that includes the command reference work below.

### What changes on screen

- **Page Map:** whose turn a thread is moves to the row's end, as in
Threads. The kind's symbol stands in a square one line tall, on the
first line of a two-line name.
- **Visual review:** each case is one row, with a plain number, its
title at the list's weight, and a ✓ at its end once it looks right.
Before, a blank line under every unchecked case was kept for "Looks
right", and rules ran between cases.
- **Timeline:** step times end together, close to their steps.
- **Threads:** the Resolved heading lines up with the threads, its count
included.
- **Menu:** a row's keys and symbols sit on its first line.
- **Unchanged:** Versions, On me and the Back presses render
pixel-identical.

### Command reference

- **Keys on the left.** Keys now lead their commands in one column, each
key set against its command, so every command starts on one edge. The
user chose this over three other layouts on 28 October; the reference's
header records the alternatives.
- **Alternatives as separate keys.** A step's alternatives are now
separate keys, two to a line, while a sequence's steps stay together. `z
/ ⌘z` becomes `z` and `⌘z`, and Move's six arrows take three lines.
- **Long commands.** A command keeps to its column and wraps there, so a
long one stays inside the row on a phone. The row, which the command's
reach covers, takes the 44px aim floor instead of the button, so a touch
description follows the command's words closely.
- **The model.** The key-sequence model carries each step's keys
(`completeRowKeySteps`), which only the reference passes in. Every other
surface draws one key per step, as before.

### Also changed

- **Workflow ink:** the ink rule for a margin entry's or a Page Map
row's symbol in `base.css` now uses a descendant combinator, so it
reaches the symbol inside the row's lead.
- **Tests:** three tests follow the parts' new places. The panel-keys
test now reads ← and → as two keys.

### Checks

- **Tests:** the browser tests covering every changed list pass (116,
plus 4 subtests), as do the runtime's Node tests and `pnpm run
check:browser`.
- **Captures:** both colour schemes were captured in Chromium, and
Threads, the menu and the Page Map in Firefox too.
- **Review:** a fresh review of the captures and the diff found five
issues, all fixed. The Resolved count stood short of the status column,
On me's nouns lost their ellipsis, the Page Map's gap reached into its
columns, cases past 9 would have shifted their titles, and an unused
note part was left in.

> _This was written by Claude Code on behalf of max-sixty_
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