Repository navigation
Let lf-timeline run on a plain HTML page, and let a command row say where a key lands - #4626
Merged
Merged
Conversation
…here a key lands `lf-timeline` now loads, draws and steps by its own buttons and marks on a plain HTML page that maps `/runtime/` and `/vendor/` with its own import map. On a Leaf page it behaves as before. Its import graph is 18 runtime modules and 104 KB of source plus `/vendor/lit.js`, down from 183 modules and 2,256 KB. On lost-update the page reaches its first presented state with 2 fewer requests and 4 KB more, against main: the drawing module is fetched only off Leaf, as lf-motion's producer is. **`lands(from)`, a command row field.** A key that steps from a row of the step list carried focus to the new step's row through `focused()` and `focusDestination()`, which live in `focus.js` and load only on a Leaf page; the lint rules for current-location reads and placements refuse the platform equivalents. The register now does it: right after it runs a row for a key, a command-reference pick or a click on the row's `control`, it calls the row's `lands(from)` with the element the press came from and puts the user on what it returns as a move. The call is synchronous, so it reads the state the run left. `runLanding` in `keyboard/scopes.js` is the one place, which the button adapter and both of the dispatcher's invocation builders use; `checked` refuses a `lands` that isn't a function; the row header in `bindings.js` and module-input.md's "Command rows" say what it means, and "Walks" points there. The timeline's rows declare `lands: (from) => rows.includes(from) ? rows[current] : null`, today's rule. Rows that move focus in their own `run`, as `lf-dial` and `lf-tabs` do, keep doing so. - Rejected: landing after a margin entry's activation too. The activation already decides focus itself (it returns the user to the entry's surface only while its origin still holds focus), so a `lands` there would either repeat that check or override it; the entry keeps its own handling. - Rejected: importing Leaf's focus helpers on the keyed path only. A dynamic import resolves a task later even for a loaded module (measured in Chromium and Firefox), after the key's frame. **A run-less row that names a control owns its keys.** Previous and Next are the widget's own buttons, as Play is lf-motion's: their rows name the press their control makes and have no `run`, and the drawing's `aria-disabled` at each end is the availability the register reads. The dispatcher didn't count such a row as making its press (`ownsLeafInvocation`), so while it was unavailable its scope stopped claiming its key, and ArrowRight on a deck's timeline at its last step turned the deck's card, against keyboard/AGENTS.md's rule that an unavailable command's press reaches no other command. A row now owns its keys when it or one of its routes names a `control`, since Leaf makes that press with `click()`; the dispatcher's comment and module-input.md's "How scopes compose" say so. No other row in the tree is run-less with keys and a control (a scan of `browser/`, `packages/` and `examples/`), so nothing else changes. **The rest, as lf-motion does it.** The drawing moves beside the widget (`widgets/timeline-view.js`) and imports the portable helpers, including the time axis's; the initial bundle imports it and holds the same code as before. The widget extends `HTMLElement`, draws the drawing's template with Lit in the task that changes it, and shows `failSoft`'s box on a throw. Off Leaf the element is defined once its drawing module arrives, so it upgrades with the producer in hand. Off Leaf a step row is neither a button nor a tab stop, since only Leaf's step row makes Enter and Space work; the pointer still picks it. The `quoted(this)` check before keeping the step goes: ids are unique across a page and its replies, and a sample's frame keeps its tab store under its own page root. - Rejected: native `<button>` step rows. widget-elements.js keeps a page word that is also a control a span with a role so it stays selectable, its drag guard tells a press from the release that ends a selection, and Leaf's theme dresses selectable offers and native buttons differently; moving the rows to buttons reopens that decision for every selectable offer, not just these. **Tests.** - The smoke test adds lf-timeline (transport with its symbols, a row per step), clicks Next to reach the second step, and with the keyboard alone reaches Previous and Next by Tab and steps with Enter and Space. It failed with Previous's click listener removed. - New `test_a_timeline_s_unavailable_arrow_reaches_no_command_around_it`: a timeline in a deck, at its last step, keeps the deck's card and the user's place on ArrowRight. - Each failed when undone: the dispatcher not counting a run-less control row (the deck turned and focus left the row); the rows without `lands`, and the dispatcher running rows without landing (focus stays on the first row after ArrowRight in `test_timeline_steps_by_every_route_and_keeps_the_step`); the widget importing `widget-api.js` (the smoke test's load error). - Also run: `pnpm run test:runtime` (695), `pnpm run check:browser`, pre-commit, `test_timeline.py`, `test_motion.py`, `test_key_surfaces.py`, a board's keyboard move, a diff's hunk step, retained moves, the initial-delivery tests, initial settlement, the pending-task hold, the public API before boot, and a reply's widget module. No row whose routes name controls has keys yet, so that half of the ownership rule has no test. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Oct 28, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…ds for presses that go elsewhere (#6092) Asked to keep a keyboard user in a list after Remove, Claude Code widget authors often worked out the nearest surviving row themselves in the command row's `lands(from)` instead of holding focus with `holdFocus(list, { key })`. `module-input.md` didn't say that a keyed hold tries the caller's stand-ins after the surviving items (one author skipped it because it "has no Add item fallback for an empty list"), and `module-authoring.md` called `lands(from)` "where a key leaves the user", which reads as the place for every landing. `module-input.md` now gives the hold's order and says a run that redraws the user's own place holds focus, leaving `lands` to a press that takes the user elsewhere, as lf-timeline's step arrows do (#4626). In `widget-list-keeps-focus`, Claude Code passed 13 of 13 with the change against 9 of 16 without it; Codex passed 5 of 5 on both arms. The case's rubric now also accepts a native popover opened through `popovertarget`, which `module-input.md` says returns the user to its control on closing; regrading the six earlier outputs under it changed no grade. To weigh: the earlier 2 of 6 didn't recur at this merge base (7 of 10), so the size of the gap is uncertain. Requested by max-sixty. Checks: the eval runs above, pre-commit. > _This was written by Claude Code on behalf of max-sixty_
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.
lf-timelinenow loads, draws and steps by its own buttons and marks on aplain HTML page that maps
/runtime/and/vendor/with its own import map.On a Leaf page it behaves as before. Its import graph is 18 runtime modules
and 104 KB of source plus
/vendor/lit.js, down from 183 modules and 2,256KB. On lost-update the page reaches its first presented state with 2 fewer
requests and 4 KB more, against main: the drawing module is fetched only off
Leaf, as lf-motion's producer is.
lands(from), a command row field. A key that steps from a row of the steplist carried focus to the new step's row through
focused()andfocusDestination(), which live infocus.jsand load only on a Leaf page;the lint rules for current-location reads and placements refuse the platform
equivalents. The register now does it: right after it runs a row for a key, a
command-reference pick or a click on the row's
control, it calls the row'slands(from)with the element the press came from and puts the user on what itreturns as a move. The call is synchronous, so it reads the state the run left.
runLandinginkeyboard/scopes.jsis the one place, which the button adapterand both of the dispatcher's invocation builders use;
checkedrefuses alandsthat isn't a function; the row header inbindings.jsandmodule-input.md's "Command rows" say what it means, and "Walks" points there. The timeline's rows declare
lands: (from) => rows.includes(from) ? rows[current] : null, today's rule.Rows that move focus in their own
run, aslf-dialandlf-tabsdo, keepdoing so.
already decides focus itself (it returns the user to the entry's surface
only while its origin still holds focus), so a
landsthere would eitherrepeat that check or override it; the entry keeps its own handling.
import resolves a task later even for a loaded module (measured in Chromium
and Firefox), after the key's frame.
A run-less row that names a control owns its keys. Previous and Next are
the widget's own buttons, as Play is lf-motion's: their rows name the press
their control makes and have no
run, and the drawing'saria-disabledateach end is the availability the register reads. The dispatcher didn't count
such a row as making its press (
ownsLeafInvocation), so while it wasunavailable its scope stopped claiming its key, and ArrowRight on a deck's
timeline at its last step turned the deck's card, against keyboard/AGENTS.md's
rule that an unavailable command's press reaches no other command. A row now
owns its keys when it or one of its routes names a
control, since Leaf makesthat press with
click(); the dispatcher's comment and module-input.md's "Howscopes compose" say so. No other row in the tree is
run-less with keys and a control (a scan of
browser/,packages/andexamples/), so nothing else changes.The rest, as lf-motion does it. The drawing moves beside the widget
(
widgets/timeline-view.js) and imports the portable helpers, including thetime axis's; the initial bundle imports it and holds the same code as before.
The widget extends
HTMLElement, draws the drawing's template with Lit in thetask that changes it, and shows
failSoft's box on a throw. Off Leaf theelement is defined once its drawing module arrives, so it upgrades with the
producer in hand. Off Leaf a step
row is neither a button nor a tab stop, since only Leaf's step row makes Enter
and Space work; the pointer still picks it. The
quoted(this)check beforekeeping the step goes: ids are unique across a page and its replies, and a
sample's frame keeps its tab store under its own page root.
<button>step rows. widget-elements.js keeps a page wordthat is also a control a span with a role so it stays selectable, its drag
guard tells a press from the release that ends a selection, and Leaf's theme
dresses selectable offers and native buttons differently; moving the rows to
buttons reopens that decision for every selectable offer, not just these.
Tests.
clicks Next to reach the second step, and with the keyboard alone reaches
Previous and Next by Tab and steps with Enter and Space. It failed with
Previous's click listener removed.
test_a_timeline_s_unavailable_arrow_reaches_no_command_around_it: atimeline in a deck, at its last step, keeps the deck's card and the user's
place on ArrowRight.
(the deck turned and focus left the row); the rows without
lands, and thedispatcher running rows without landing (focus stays on the first row after
ArrowRight in
test_timeline_steps_by_every_route_and_keeps_the_step); thewidget importing
widget-api.js(the smoke test's load error).pnpm run test:runtime(696 after rebasing on Let lf-motion run on a plain HTML page, with Leaf's Lit loading anywhere #4616),pnpm run check:browser,pre-commit,
test_timeline.py,test_motion.py,test_key_surfaces.py, aboard's keyboard move, a diff's hunk step, retained moves, the
initial-delivery tests, initial settlement, the pending-task hold, the public
API before boot, and a reply's widget module. No row whose routes name
controls has keys yet, so that half of the ownership rule has no test.