Skip to content

Offer each moment's next press at the panel field's end - #5630

Merged
max-sixty merged 6 commits into
mainfrom
c-key-affordance
Nov 7, 2026
Merged

max-sixty merged 6 commits into
mainfrom
c-key-affordance

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The panel field's right side now offers the press that matters most at that moment, in the format Comment… c already uses: the word, then its key, dim and italic. Max picked the rule and its moments on a review page; #5613 built the first of them, Undo z after a Resolve, and this PR rolls out the rest.

Moment The field's end shows
Right after a Resolve, with an open thread left Next thread t (with none left, Undo z as before)
After the user answers, with more On Me Next On Me m
A thread open in the panel Reply… c
Draw or Design mode Close esc, in place of the seat's ✕
Reading an older version Comment… c, with the older version's chip after the field
Words selected on the page the quote in the field's words, with Comment… c at its end

How it works

  • One press shape. A box's field end draws a BoxPress {word, keys, run} (composing/text-field.js). A notice's press (notifications.js, offerPress) lives as long as the notice: the user's next input withdraws it, unless that input is on the press itself.
  • Presses run as commands. Pressing one runs its command through pressCommand (keyboard/dispatch.js), the route touch controls take, so it acts wherever the caret is. The key shows only while activeCommandLabel says that key reaches the command now, and Close shows esc only while escapeInvocation() says Escape would end the stance. The target picker's letter take-back became its own row, targeting.letter.back, so Escape and Close never disagree there.
  • Next thread comes from nextStep in thread/folding.js when anyOpenThread finds one; otherwise the Resolve keeps offering Undo.
  • Next On Me comes from the server's reading, not a browser prediction: application.js offers it when an obligation's answer.event.id is the gesture's own id and On Me still holds something. Picks, settling reactions and card replies offer it.
  • Holding still. While the pointer is on the panel the shown press stays put (pagePress in floating-panel.js), and it repaints on pointerleave if the moment changed. The per-frame recheck in composing/input.js reads the press's key getters rather than recomputing the field's words, which walked the queues, so a keystroke's cost doesn't grow with the page.

Decisions

These were put to Max on the review page, and he kept them:

  • The older version's chip steps aside while a press stands, so news arriving doesn't move the press. In Draw or Design mode on an older version it stays hidden until the mode ends; the menu's Latest still works.
  • No Next On Me after a comment or reply sent from the panel's own field: the caret stays there for the next turn, and offering it would mean moving the caret out after every send.
  • Close esc ends every stance: Select mode and a region capture as well as Draw and Design.
  • After the panel's own Resolve, which already opens the next thread when the thread came from Threads, Next thread moves on to the one after it.

Testing

dev/leaf_dev/states.py gains a stills state for each new moment (panel-resolved, ship-option-answered, panel-draw-mode, panel-selection); the before/after stills were reviewed on the review page. Browser tests cover each press: the Resolve tests now expect Next thread t, and with no thread left Undo z; navigation/test_on_panel.py covers Next On Me after an answer; test_render_semantic_selection.py covers the picker's Close against Escape; render_harness.field_press reads the field's end. Two independent Codex reviews found five defects and one per-keystroke cost, all fixed on the branch.

Locally: the runtime tests pass (896/896), the type check passes, and the focused browser tests pass except test_threads_holds_a_row_that_joins_or_moves_behind_a_notice, which fails the same way on main (#5614's folded-leaf preview moves the row 330 px with no input).

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

The user chose, from three weeks of their keys, which press the floating panel's
field offers at its end in each moment, in Comment… c's face (6 November 2026):

- After a Resolve, the notice "Resolved “…”" offers Next thread t, the `t` walk,
  while an open thread remains, in place of Undo z; with none left, and after a
  Reopen, it still offers Undo z (thread/folding.js, `nextStep`). `z` and the
  menu's Undo still take a Resolve back.
- After an answer (a widget pick, a comment or a reply) with more On me, the field
  offers Next On Me m once the server's reading of the answer is in, until the
  user's next input (application.js, `offerNextOnMe`; notifications.js,
  `offerPress`, which gives a press offered alone a notice press's lifetime).
- In a stance such as Draw or Design mode, the field names the stance and ends in
  Close esc, and the seat keeps the On me mark; the ✕ takes the seat only while the
  field doesn't say Close, as while the user writes or words stand selected.
  Searches keep their ✕, since they own the field.
- With words selected, the field quotes them and ends in Comment… c, as at rest,
  in place of c alone after the quote.

The row's older-version notice now stands aside while the field's end offers a
press, as it does for words, so a notice coming or going on news doesn't move the
press. `commandSteps` resolves a route's id to that route's key, so `thread.next`
spells `t`. `anyOpenThread` moves to thread/state.js for the Resolve's notice to
share with the walk.

Tests: the panel's Resolve tests assert Next thread t and, with no thread left,
Undo z; the #5320 notice test resolves the last open thread so its Undo stays the
press under test; the stance tests leave by the field's Close; the selection test
reads Comment… c. The reader surface of the ways-back test leaves the notice's
Undo out, since its workspace keeps other threads open.
…press

panel-resolved, ship-option-answered, panel-draw-mode and panel-selection open
the floating panel's row right after a Resolve in its thread view, after a pick
that leaves more On me, in Draw mode, and quoting words a script selected, so
`leaf-dev stills` compares the press each offers with the base's.
…erver's reading

Fixes from an independent review of the field-end presses (b3e41bd):

- A press at the panel field's end (Next thread, Next On Me, Close) acts as a touch
  control does, wherever the caret stands, and says its key only while that key would
  make it now, as the dispatcher reads it (`activeCommandLabel`). After a reply sent
  from a card the caret stays in the card's box, where `m` is a letter typed, so Next
  On Me stands without its key; `executeCommand` met the box's text-entry claim there.
  The dispatcher gains `pressCommand(id)`, which makes a command's or route's press
  through `invokePress` as touch controls do. The boxes standing a press read it again
  in the repaint frame that publishes the comment key's destination, since the
  dispatcher's reading follows focus and the keys' liveness, not a signal.
- Which On me items a gesture answered is the server's reading, each obligation's
  `answer.event`, so a pick, a settling reaction (Keep 👍) and a card reply all offer
  Next On Me, and a playground's unsent settings never do. `answers()`, the browser's
  second and incomplete classifier, and its x-state `unsent` read are gone.
- Next On Me arrives with the server's reading rather than the user's input, so while
  the pointer rests on the panel the field's end keeps what it showed, taking the
  change at the next input or once the pointer leaves: it could replace Comment… c
  under a pointer on its way to press it.
- Close always ends its stance, and says `esc` only while Escape takes the stance off
  now (`escapeInvocation`): in Design mode with a widget's comment box open, Escape
  closes the box first, so Close stands alone. The target picker's Escape takes back a
  typed hint letter as a step of its own (`targeting.letter.back`), so the picker's
  way out, by Close or ✕, closes it whatever letters are typed.
- A reply or comment sent from the panel's own field keeps the caret there, so Next On
  Me follows picks, settling reactions and replies sent from a card; the headers say
  so.

Tests: Next On Me after a card reply stands without `m` while the caret is in the
box, walks on a click and then says `m`; the picker's Close drops `esc` once a hint
letter is typed and closes the picker on a press.

The repaint frame repaints a box only when its press now reads otherwise than it drew:
asking every pressing box to repaint each frame looped, since a box's paint marks its
keys for the next frame.
Each frame that publishes the comment key's destination rechecks every box standing a
press, since whether its key would make it follows focus rather than a signal. The
recheck called the box's `enters()`, which for the panel's page field built the
status's words, walking every On me and On agent item, on every such frame while Next
On Me stood: work that grew with the page for a control that didn't change (found by
an independent review of 82bdce0).

A field-end press now reads its keys at each ask (`noticePress`, `stanceClose`), and the
recheck asks the press as drawn for them, so it costs the dispatcher's reading of one
command. Nothing the user sees changes.
main's folded-leaf preview (#5614) reads commandSteps in floating-panel.js, whose import this branch had dropped once its presses read their keys from the dispatcher; the import is back. The panel tests' imports take both sides.
@max-sixty
max-sixty merged commit f438a9e into main Nov 7, 2026
5 checks passed
@max-sixty
max-sixty deleted the c-key-affordance branch November 7, 2026 09:03
max-sixty added a commit that referenced this pull request Nov 7, 2026
… wherever they show; the shift watch credits a preview riding its target (#5638)

This fixes the causes left on `main` after #5614 and #5617 that #5629
didn't cover, and two gaps review found in the preview's Escape step.
The
file editor's gutter finding was not caused by #5617 (see **Left
open**).

## Keys a control says

#5614 made a control's `aria-keyshortcuts` and its preview's key chips
name every key any row binds to it, wherever the user stood. A screen
reader announces the attribute with no context, so it promised keys that
did nothing. The Inspect button in
`test_obligation_contextual_bindings_are_independent_of_widget_bindings`
said `x y` while the user was on the suggestion, where only `3` presses
it, and kept `x` after a nearer, unavailable declaration took it.

Both now come from one reading: the dispatcher's reachable bindings from
where the user is (`availableCommandRoutes`), each under the control its
row or route names (`reachingNow`, `keyboard/control-keys.js`). The
preview reads it as it shows. `paintCoreControls` writes the attribute
each frame for the controls whose keys moved. The command hints read the
same reading for their faces, and their separate per-frame
`aria-keyshortcuts` projection is gone. Exports paint the attribute too.

Behaviour changes against `main`:

- Resolve says `r` only where `r` presses it, on its thread. With the
  caret in the reply, where `r` is typed, it says no key.
- A focused control's own Enter and Space, the platform's press of any
  control of its kind, draw no chip. Its attribute still names them.
- A close control says Escape only where a row says Escape presses it,
as
  the image viewer's does. The floating panel's ✕, a margin card's and
Page Map's say no key, since their Escape steps don't name the control,
though Escape from inside those surfaces closes them. The panel field's
  Close, added in #5630, keeps its own `esc`.

`test_a_control_previews_its_word_and_every_key_that_presses_it`
asserted
the old rule (a hover chip `r` with the caret in the reply). It now
expects no key there and `r` once Escape leaves the reply for the
thread.

## The preview's Escape step

While a preview stands, Escape's first step puts it away. Three gaps
broke that.

**Inside an open popover.** In
`test_a_playground_opens_its_instruction_over_the_page`, after Tab
showed
Copy's preview inside the instruction popover, the first Escape put the
preview away, the second did nothing, and the third closed the
instruction. While Escape has a step of Leaf's to take, the page holds a
CloseWatcher (`keyboard/close-requests.js`), which it reads in the
repaint
frame. A standing preview is such a step, so the frame after the Tab
made
a watcher above the popover's own. Putting the preview away asked for no
frame, so the stale watcher took the next Escape's close request and
found nothing to do. The preview now reads the watcher again at once
whenever its step comes or goes (`stepMoved` calls
`paintCloseRequests`).
That holds for a key and for Back alike, even with two presses inside
one
frame.

**Back.** An earlier version of this branch refreshed the watcher from
an
Escape keydown listener, which ran ahead of `back_gesture`'s blocker, so
the back-gesture tests got a refresh real Back never makes. That
listener
is gone.
`test_a_back_gesture_after_a_preview_put_away_closes_the_popover_under_it`
is the back gesture's form of the playground test. It and the playground
test fail with `stepMoved` disabled, and pass with it.

**Inside a modal dialog.** A preview of the image viewer's Close lost
its
first Escape, which closed the viewer and the preview together, in
Chromium and Firefox; `main` does the same. The preview shows inside the
topmost modal, but its scope had no root, so the modal's floor
(`keyboard/dispatch.js`, `stack`) dropped it. The scope is now rooted at
the preview itself.
`test_a_preview_inside_a_modal_takes_escape_before_the_modal`
fails in both engines without this.

Letting the browser take the preview's Escape, tried before, closed the
panel's thread view under the preview, so the preview keeps its step.

## A preview standing clear of news drawn beneath it

In `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice`, the
landed row's focus preview stood where news then drew the notice of a
resolved thread, and the preview stood afresh clear of it, moving its
words 330 px, which the shift watch reported. That move is the preview's
deliberate answer to content arriving where it stood, as on `main`: a
notice arriving exactly under a preview is a rare path, which may move
the
preview rather than carry a hold of its own (SOUL.md, "Keep the
foundation
small and extensible"). The test now asserts that the rows hold still
behind the notice and that the preview stands clear of it, and consumes
that one move by its preview nodes, as other tests consume a deliberate
move; the watch itself is unchanged for everything else.

## The shift watch and a preview riding its target

Three tests that fold the panel with a focus preview on the Leaf button
errored at teardown. The browser carries the preview exactly with the
button (`position-anchor: auto`, `showPopover({source})`), but the watch
couldn't prove the preview anchored:

- it found anchors only by name; it now also reads the `source` of the
`showPopover` or `togglePopover` call that opened the popover, and only
  that call, since one made while the popover stands open leaves the
  browser's anchor as it was;
- it read insets only with pixel offsets; it now also reads an offset
  from a custom property, and a script changing that property still
  reports;
- it required every declaration that might be in force to be anchored.
The preview stands under the chrome guard's `all: revert-layer` and its
  own `inset: auto`, and the guard's rollback branch read that `auto`
  without asking Typed OM whether the inset is still `auto`. This third
  gap is why the implicit-anchor patch from triage passed its own tests,
  which had no guard, and left the finding in place.

The watch's anchor tests gain the preview's shape: a guarded popover on
its implicit anchor, carried by its source's translation and by its
source's scroll, clean and faulted, and one asked to show again with
another `source` while open, whose independent move must still report.
The clean cases fail on the old watch and on the triage patch alone, and
the re-shown case fails with a wrapper that records every call's source.

## Left open

- Escape steps other than the preview's still rely on the repaint frame
to
  bring the close watcher up to date. With an `lf-draft` in an auto
  popover, two quick Escapes swallow the second, on `main` too. The
watcher's sync belongs with any change to the step Escape has available,
  as the preview's now is (`stepMoved`).
- The journey
`test_file_editor_saves_quietly_and_preserves_inflight_edits`
  fails at line 142 intermittently, before #5617 as well as after:
  locally it reported the gutter in 2 of 4 runs at `ef6c01ed8` that
  reached that line, 0 of 2 at `84d918681`, 1 of 4 on `main` and 0 of 5
  on this branch. Right before the external write the gutter matches its
  lines. The watch sees the two frames after it, where CodeMirror draws
  the gutter rows 16 px tall beside 24 px lines before its measure
  corrects them. So #5617 has no hunk to bisect to, and the fix belongs
  in how the editor applies an external update, or in what the watch
  counts as content that update replaces.
-
`test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in[firefox_browser-input]`
fails intermittently on `main` as on this branch, run alone 1 time in 4
  on `main` and 1 in 3 here.

## Checks

`pnpm run check`, pre-commit on the changed files, and each changed or
nearby browser test by node id in Chromium and Firefox where it runs in
both: every test asserting `aria-keyshortcuts`, the preview's placement,
focus, Escape, modal and back-gesture tests, the close-request tests,
the
playground, the fold tests, the Threads test and the watch's anchor
tests.

> _This was written by Claude Code on behalf of max-sixty_
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]>
leaf-agent added a commit that referenced this pull request Nov 9, 2026
…#5732)

#5630 meant Draw mode, Design mode and region capture to show *Close* at
the panel field's end while the stance is at rest, in place of the
seat's ✕. Its Decisions say *Close* ends every stance, capture included.
Three browser tests still looked up the old ✕ by its accessible name
(`Exit Draw mode`, `Exit Design mode`, `Cancel capture`) and timed out
on main. They now use the field's Close press
(`render_harness.field_press`), which #5630's own tests already use for
the same exit.

- `test_render_drawing.py::test_draw_mode_leaves_chrome_controls_usable`
and `test_render_aim.py::test_design_mode_leaves_the_chrome_working`
keep their assertions. Chrome presses stay the chrome's in the mode, and
Close ends the mode.
-
`threads/test_media.py::test_touch_capture_attaches_on_lift_and_a_tap_or_cancel_attaches_nothing`
taps Close to leave capture with nothing attached. It also pressed Enter
on the ✕, and that step is removed. #5630 gives the field's press
`tabindex="-1"` on purpose (`composing/input.js`, `pressAtRest`: "The
keyboard's route is the press's own command"). Escape is that route, and
the test still checks it.

All three failed on main `2f47830e4` with the timeouts reported in
#5702. With this change they pass locally under `uv run pytest
--run-main`.

The ✕ still appears when the field is saying something else, for example
quoting selected words. On a coarse pointer, the mode-entry hints in
`drawing.js` and `design.js` still announce "Exit Draw mode leaves." /
"Exit Design mode leaves.", and the nightly journey
`tests/journeys/test_render_semantic_selection.py` asserts that wording.
At rest the button those hints name is now *Close*. Whether the hints
should name Close is a wording choice for the #5630 author, so this PR
leaves it alone.

Closes #5702 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 9, 2026
… its ResizeObserver delivery (#5736)

The floating panel's size observers call `followBox`, which wrote the
root's `scroll-padding-bottom` inside the ResizeObserver delivery. The
margin's page MutationObserver (`margin-layout.js`, `heardPage`) hears
the root's `style`, so a margin pass ran in that delivery's microtasks.
Its `lf-margin-layout` event re-placed the open thread card, widening
`#lf-margin-preview` (320 → 403 px) after the delivery had already gone
deeper than the card. Chrome then reported `ResizeObserver loop
completed with undelivered notifications`. `page-layout.js` already
states the rule this broke: a size delivery may write only what nobody
observes, or queue work for a frame.

The fix keeps `stateFootBand` immediate, since Leaf's own landings read
the band from it. The root's padding, which only the browser's own
reveals read, and `announceRoom` now land in the next rendering pass
(`nextRender`, coalesced).

**Why it surfaced at #5630:** at #5630's parent the same writes happen
in the same frame. There, though, the panel observer's first round
included a detached `<svg>` at depth 1, so Chrome's second round still
reached the card (depth 4). #5630 keeps that svg connected (depth 11),
which leaves the panel host (depth 5) as the shallowest first-round
target, and the card's resize goes undelivered. So #5630's intent and
interface are untouched; it removed an accident that had hidden the
write.

**Verification:**
`tests/journeys/test_render_drawing.py::test_a_drawing_is_sent_and_replayed_as_an_ordinary_comment`
fails on main `2f47830e4` and passes 3 of 3 runs with the change. Other
checks run locally, all passing:
- the whole drawing journey file;
- the tests that read the panel's band or land clear of it
(`test_chrome_contracts`, `drafts/test_keys`, `navigation/test_threads`,
`widgets/test_obligations`, `controls/test_focus`,
`threads/test_composing`, three `test_render_floating_panel` cases): 35
passed;
- `pnpm run test:runtime` (906), the browser type check and pre-commit.

<details><summary>How the writer was found</summary>

Ran an instrumented copy of the journey that wrapped `ResizeObserver`
and logged each delivery with its targets' flat-tree depths, each
`--lf-thread-width` write with its stack, and the margin's `heardPage`
records. The error frame is the `g` `T` that opens Threads. The panel's
`follow` observer (`floating-panel.js`, `sizeObserver` → `followBox`)
delivers, and then a microtask's `heardPage` sees `HTML.style =
scroll-padding-bottom: 192px`. It runs `layoutMarginRows`, and
`margin-projection.js`'s `lf-margin-layout` listener calls
`card.place()`, whose placement writes `--lf-thread-width: 553px`. At
the parent the same sequence runs, with the extra depth-1 entry in the
first round.

`layoutMarginRows` is also a size observer's callback itself
(`layer.sizes`), so the same card placement can happen inside a delivery
by that route. This run neither reproduced nor changed that route.
#5708's corpus-page loop errors have a different onset (#5617) and are
not established to share this path.

</details>

Closes #5709 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 21, 2026
#6679)

When a comment box closes with unsent words, the panel's field said
"Draft kept — g i resumes writing", spelling the key out in the notice's
words while the field's right end, the place for a moment's next press
and its key since #5630, still showed *Comment…* `c`. The notice now
says "Draft kept" and offers Resume writing as its press, so the field's
end reads *Resume writing* `g` `i`, and a click on it brings the box
back as `g i` does.

To weigh: like every notice that offers a press (Resolve's *Next
thread*, *Undo*), "Draft kept" now stands until the user's next input
rather than for four seconds. `noticePress` read keys only from
`activeCommandLabel`, which finds none for a Go-to destination until `g`
is pressed, so `keysNow` in `floating-panel.js` adds the destination's
Go-to steps while `g` would open Go-to; Open latest's `g V l` now reads
its keys through it too. A refused send's error keeps "g i resumes
writing" in its words, since an error offers no press. The since-seen
notice ("3 changes since v12 — v shows them") still names its key in
words, by an earlier choice recorded in `since-seen.js`.

Max asked for this in a Claude Code session. Tests: the composer test
brings the box back by the press and by `g i`; the four tests that read
the notice expect "Draft kept"; `pnpm run check:browser` and `pnpm run
test:runtime` pass.

> _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