Skip to content

Draw every symbol press from its action, so an action shows one symbol everywhere - #4547

Merged
max-sixty merged 6 commits into
mainfrom
symbol-buttons
Oct 28, 2026
Merged

max-sixty merged 6 commits into
mainfrom
symbol-buttons

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Every button that shows a symbol now names its action rather than an icon. ACTIONS in browser/runtime/icon-paths.js is the single place where each action's symbol and name are set, so an action can no longer show a different symbol on a different surface. The survey in #4514 found several that had drifted: Discard drawn as an undo arrow in one editor and ✕ in another, Save drawn as ✓ or as the save mark, and Reopen shown as a word on one surface and a check on another. Each of those had been fixed by hand. With this change a symbol can only come from its action.

The contract

  • offerAction(role, className, label, {title, action}) and offeredAction(...): a "symbol" or "mark" press must name an action. It draws that action's symbol itself and says the action's name as its tooltip and accessible name, unless label says more ("Retry source inspection"). A symbol press without an action, or with an unknown action, throws. A word or commit press that passes an action throws too. Templates drop their ${iconTemplate(...)} content, because the writer draws the symbol, and leaves it untouched when it's already right, so later renders write nothing.
  • actionOffers(base) in icon-paths.js builds both constructors. The runtime wraps the prepaint ones with it, and so do first-paint producers (timeline, playground, lf-shot), so the inline prepaint stays glyph-free.
  • Presses that build their own face draw through actionTemplate(action), actionElement(action) and showAction(control, action). These cover the floating panel's buttons, message controls, video controls, the copy control's slot and motion's play. showAction handles a press whose action follows its state, such as Expand all ↔ Collapse all or the deck's Next ↔ Start, and replaces the hand-rolled symbol swaps in lf-deck, lf-sample, lf-diff and lf-call-diff.
  • contributionEntry takes action beside glyph and icon. icon stays for an entry that shows what it holds, such as a margin entry's kind. responseAction, wireInput, copyControl and page-control exit rows name an action in place of an icon.
  • Icons no action names (kinds, states, the chevrons beside worded rows) keep iconTemplate and iconElement.

Whether a press is a word or a symbol stays the author's call. An earlier commit also refused a word button whose label was an action's name. A page's own to-do "Done" tripped it in test_a_rewrite_keeps_the_message_as_it_stood, so that refusal is gone: it was taste enforced on authors, which /developing-leaf "Leave taste to the authoring agent" rules out.

Protocol

offerAction's icon option became action, which is a change to the public package API that a page vendored earlier would break on, so this bumps $events.protocol to 35.

Checks

  • pnpm run check passed, including the new tests/runtime/action-offers.test.mjs.
  • 37 focused browser tests passed, rerun after merging Share Lit views across initial delivery and live updates #4545: page search steps, folding the panel, Image options, call-diff and diff fold-all, diff Retry, deck, timeline, motion, playground reset and instruction, sample full view and reset, Reopen on margin cards and threads, rewrites, lf-draft editing, suggestions, dial, code copy, video, On me, the menu's Undo, added options, and the About dialog's Show on page and Retry, and three lf-trace render tests.
  • leaf-dev stills: the timeline state came out pixel-identical. The other states timed out on both arms at a load average above 100, so I stopped the run.

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

…l everywhere

WIP: description follows in the PR.
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-copy-control.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-disclosure.js
#	dist/kernel/runtime/bundle-layer-client.js
#	dist/kernel/runtime/bundle-page-inspection.js
#	dist/kernel/runtime/widget-api.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 trace viewer fails to initialize under the new action contract; the Play/Pause control still needs to be migrated.

Reproduction

uv run pytest -q -n0 tests/browser/test_render_playwright_trace.py::test_trace_viewer_stays_idle_after_initial_presentation reports <lf-trace id="release-trace"> failed: A symbol names the action it shows at this head. A leaf-dev probe developer/playwright-trace-gallery --base=origin/main comparison renders the trace controls on the base, while the candidate reports that exception and renders no trace controls.

Comment thread packages/playwright/widgets/lf-trace.js Resolved
# Conflicts:
#	dist/kernel/kernel.json
#	packages/default/initial/lf-shot.js
#	packages/default/vendor/lf-shot-initial.js
#	packages/default/widgets/shot-view.js
#	packages/motion/initial/lf-motion.js
#	packages/motion/vendor/lf-motion-initial.js
#	packages/playground/initial/lf-playground.js
#	packages/playground/vendor/lf-playground-initial.js
#	packages/playwright/widgets/lf-trace.js
#	packages/timeline/initial/timeline-view.js
#	packages/timeline/vendor/lf-timeline-initial.js
@max-sixty
max-sixty merged commit 2916e52 into main Oct 28, 2026
4 checks passed
@max-sixty
max-sixty deleted the symbol-buttons branch October 28, 2026 04:28
max-sixty added a commit that referenced this pull request Oct 28, 2026
…s a role does (#4563)

A runtime press that wears a role's face took its symbol and name from
`ACTIONS` (#4547), but a press whose face its surface draws, such as the
floating panel's, drew `actionTemplate(action)` and spelled its tooltip
and accessible name by hand. The two could drift, and had: On me's Show
said "Show" where the action said "Show on page".

`nameAction(control, action, {label, title, className})` in
`widget-elements.js`, with its template directive `namedAction`, gives
such a press the action's symbol and name together, as a symbol role
does; `label` and `title` say more where the press needs to ("Resolve
thread", "Edit message", "Full screen", the composer's Send wording and
keys). `actionName` in `icon-paths.js` is the one home of an action's
name, read by both paths.

Cut over: the panel's On me mark and stance exit, More/Less room, Show,
Undo, Done, Find, Resolve/Reopen and the thread view's Show on page; a
message's Edit, Add reaction and the rewrite's Discard; the composer's
Send and Dictate; a recording's Full screen. `actionTemplate` stays for
a symbol that isn't a press's whole face, such as a menu row's icon or
the second of two symbols a press swaps by CSS (a recording's and a
trace's play/pause).

The `show` action's name is now "Show": it takes the reader to where a
thing stands, which On me's Show does whether that is the page or a
message. The thread view's seat and About's row say "Show on page" or
"Show in message" as their label.

Behavior: the panel's Find and a recording's Full screen now carry a
tooltip matching their accessible name; every name is otherwise
unchanged.

Package widgets are left as they are: giving them `namedAction` would
change the public package API and the page protocol, and their
hand-written names (`lf-file-editor`'s Retry) match their actions today.

Checks: `pnpm run check` (runtime tests 693/693, with a new case in
`action-offers.test.mjs`), the role-face lint, and 28 focused browser
tests covering every test that finds these presses by name.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 28, 2026
… it can't colour (#4565)

One run of the daily corpus ring sweep
(`test_each_sampled_focus_ring_is_shown_whole_in_its_surface`) with
#4556's screenshot reading found no ring a user sees broken. Before it
got that far, it stopped on four faults in the tests. Three of them fail
the next scheduled run.

**Faults in the readers and fixtures**

- **macOS StopIteration in `_read_ring_boxes` (#4432):** the probe
stashed the projected focus mark (`.lf-visual-mark-focus`), and the
runtime replaced it before the CDP read, leaving a detached node with no
`::after` styles. Instrumenting the read confirmed it: `connected:
false`, `pseudoElements: []`. `rings_drawn` now waits for `rendered`
before reading, and so does the Tab walk after each Tab. The per-test
wait #4556 added to the table test is removed.
- **Resolved threads:** #4538 folds them under Threads' Resolved
heading, so `open_panel_thread_holding` never found one. It now unfolds
them (`show_resolved`).
- **`test_rings.py` fixture widget:** it still passed `offerAction` the
`icon` option that #4547 renamed to `action`, so its page failed to load
and four tests errored.
- **Landed diff line:** it was read while `]`'s landing still scrolled
the page smoothly. `page_at_rest` doesn't wait for that, because
`moving()` counts only Web Animations, so this scope now waits with
`scroll_settled`.

**The pixel reading's six findings, each whole on screen**

The reading now leaves to the hit-test reading any ring whose colour it
can't predict:

- a ring faded with its box (two disabled controls at 0.55 opacity);
- a ring in a scaled box (a film's terminal in an SVG `foreignObject`,
whose 1.5px band blends with its ground);
- an inline box split over lines, where each fragment wears its own
ring.

It also skips points where a button or link of the box's own stands in
front, as a draft's toolbar seated on its top border does. Ring geometry
now scales a scaled box's band and offset.

**Checks**

- Restoring the card message's own outline still fails "its top edge
shows the ring at 0% of its 24 samples".
- The sweep, `test_rings.py` (Chromium and Firefox),
`test_card_reply.py` and the table ring test pass locally: 72 tests.

Closes #4432

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

---------

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Oct 31, 2026
Main moved the playground's initial producer into widgets/playground-view.js
(#4545), lets page CSS reach every control (#4490), draws presses from their
actions (#4547, #4563), registers commands through lfCommands, and already
lets a playground run with no lf-playground-control. The PR's prose about
offer() and data-controls, its relaxed control check and its deleted
initial/vendor producer files take main's side.

What stays from the PR is actions="page", now built in the Lit view:

- playground-view.js draws no actions bar under actions="page", and no rail
  unless controls are written there; the instruction renders after the stage,
  where it was written. `give({submit, reset})` takes the page's buttons, and
  render writes the submission's words into the page's button from the same
  template Leaf's own submission uses (submit-label, then Undo choice).
- lf-playground.js's registerActions hands the buttons to the view and sets
  the playground's commands then, since a Decision command needs its control:
  the 1 key, Alt+0 and On me's arrival reach the page's buttons. A page that
  never calls registerActions still fails after first presentation.
- The copy control and popover wiring run only when Leaf draws the popover.
- The PR's test and corpus fixture pass the contributor editor main's
  registerContributor now requires.

Behavior from main kept: the submit no longer disables while a submission is
in flight (#4516), so a page's button follows the same rule.
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