Skip to content

Hold the state that keys read in signals, so a pointer or paste repaints them - #3342

Merged
max-sixty merged 2 commits into
mainfrom
agent-a58637275ccc3deed
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a58637275ccc3deed

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Key and button availability are tracked effects (keyboard/scopes.js): each reflection re-reads a row when a publication part or a signal it read moves. A row whose when reads a plain module variable is read once and then left as it was until something else marks it. #3337 met one such row: page search's arrows stayed aria-disabled beside "1 of 3" after a filled query, and it marked the search box's buttons by hand (paintKeysWithin) each time the count painted.

An audit of the rows wired to buttons, plus a probe that compares each element's painted aria-disabled and aria-keyshortcuts with a forced full reflection after random presses and fills on the shipped examples, found three more owners:

  • The floating panel's open views (trail), whether its menu is open, and the list standing in the menu were plain variables. Opening Threads or On me by pointer left the field without its Escape and the Threads view without its / in aria-keyshortcuts, and putting a view away left them behind.
  • The comment box's anchor (fabAnchor in composing/surface.js) was one too. Taking the box down by pointer, as a press on a file's comment button does from a diff line, left its hidden input naming Tab for its other responses.
  • The diff filter's Escape (diff.search.back in lf-diff.js) asked :focus-within directly rather than through standingIn, so its reading never followed where the user stands. A press outside a filtered diff left the diff naming Escape.

All four owners now read that state through signals, and page search no longer marks its buttons by hand. scopes.js states the rule: a module's own state that a row reads is a signal, and only document state is marked by its writer.

The floating-panel Escape test now opens Threads by pointer and expects the field and view to name their keys, and the field to drop Escape once the view is put away. It fails on the previous panel.

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

max-sixty and others added 2 commits October 20, 2026 08:16
…nts them

Key and button availability are tracked effects (`keyboard/scopes.js`):
each reflection re-reads a row when a publication part or a signal it
read moves. A row whose `when` reads a plain module variable is read once
and then left as it was until something else marks it. #3337 met one such
row: page search's arrows stayed `aria-disabled` beside "1 of 3" after a
filled query, and it marked the search box's buttons by hand
(`paintKeysWithin`) each time the count painted.

An audit of the rows wired to buttons, plus a probe that compares each
element's painted `aria-disabled` and `aria-keyshortcuts` with a forced
full reflection after random presses and fills on the shipped examples,
found three more owners:

- The floating panel's open views (`trail`), whether its menu is open,
  and the list standing in the menu were plain variables. Opening Threads
  or On me by pointer left the field without its Escape and the Threads
  view without its `/` in `aria-keyshortcuts`, and putting a view away
  left them behind.
- The comment box's anchor (`fabAnchor` in `composing/surface.js`) was
  one too. Taking the box down by pointer, as a press on a file's comment
  button does from a diff line, left its hidden input naming Tab for its
  other responses.
- The diff filter's Escape (`diff.search.back` in `lf-diff.js`) asked
  `:focus-within` directly rather than through `standingIn`, so its
  reading never followed where the user stands. A press outside a
  filtered diff left the diff naming Escape.

All four owners now read that state through signals, and page search no
longer marks its buttons by hand. `scopes.js` states the rule: a module's
own state that a row reads is a signal, and only document state is marked
by its writer.

The floating-panel Escape test now opens Threads by pointer and expects
the field and view to name their keys, and the field to drop Escape once
the view is put away. It fails on the previous panel.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e4c5549 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-a58637275ccc3deed branch October 20, 2026 15:39
max-sixty added a commit that referenced this pull request Oct 21, 2026
A new nightly test, `test_presses_and_fills_leave_no_element_naming_stale_keys` in `tests/journeys/test_render_navigation.py`, holds the rule `keyboard/scopes.js` states: a module's own state that a row's `when` reads must be a signal. Before this change nothing enforced it, and #3342 found four rows that read plain variables and left `aria-keyshortcuts` or `aria-disabled` stale.

The test runs the probe #3342 used. For each public example and developer page, it makes 40 random presses and fills on visible controls, in an order seeded by the example's name. After each step it waits for the page's readiness, for every send to come back, and for rendering. It then reads every element's `aria-keyshortcuts` and `aria-disabled`, forces a full key repaint (`paintKeys()`), and reads them again. It fails on any attribute the repaint changed, naming the step, the control pressed and the element. The keys themselves still work when a row is stale, since a press reads the rows afresh, so no other test catches this.

## The stale row it found

On this PR's first CI run the sweep failed on `code-comparison`. After a press on a closed tab, the tab strip still named Enter and Space. The strip's "open the tab" row read `aria-selected` on the focused tab, which no signal tracks. A person's press focuses the tab on mousedown and opens it on click, a few frames later. So the strip read the focused tab while it was still closed, and nothing told it to read again once the tab opened. `lf-tabs` now holds the open panel in a signal (`#active`), and the row compares the focused tab with the open one. A new browser-tier test, `test_a_pressed_tab_stops_naming_the_key_that_opens_it`, holds the mouse down for a frame before releasing. It fails on the previous `lf-tabs` and passes now.

I also put #3342's diff-filter fix back (`lf-diff.js` asking `:focus-within` directly), and the sweep failed on `diff-thread-gallery`, naming the diff whose `aria-keyshortcuts` kept or lost `Escape`.

## Waits instead of the probe's fixed delay

The probe waited a fixed 400 ms. Two of its findings were readings taken mid-operation rather than stale rows. A live sample's Reset is `aria-disabled` while its child loads, and the child finished loading between the two readings. A playground's Build query was `aria-disabled` until its send came back. The test waits for page readiness, which counts each sample's arrival, and for `round_trip`, so neither reads as stale.

## Write-watch findings on the sweep's path

The random presses also met three findings from the write watch, which this change fixes so the test passes:

- **The merge film** (`examples/wt-merge.page/film.js`) removed every annotation note and drew it again on each paint. The painter dropped unseen parts before `#paintNotes` marked the notes as seen; it now drops them after every layer has painted. The corpus copy is regenerated.
- **The playground's Copy button** wrote the same `data-copy-state` again when pressed twice within two seconds. It now writes through `keeps`.
- **Sortable** sets a card's `draggable` to false on every release of its grip, whether or not the press became a drag. It is vendored, so `write_watch.js` lists that write in `EXPECTED`.

## Cost

Locally, under load from other sessions, the 28 cases take 202–306 worker-seconds in total over seven runs (about 3.5–5 worker-minutes), and 70–78 s of wall time on 4 workers. The slowest are `wt-merge` and `pr-walkthrough`, each up to about 40 s. It runs one seed; the decision estimated about 6 worker-minutes per seed.

This is Max's decision #31 (option C) on the overnight report.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 21, 2026
… signal (#3456)

A new nightly test,
`test_presses_and_fills_leave_no_element_naming_stale_keys` in
`tests/journeys/test_render_navigation.py`, holds the rule
`keyboard/scopes.js` states: a module's own state that a row's `when`
reads must be a signal. Before this change nothing enforced it, and
#3342 found four rows that read plain variables and left
`aria-keyshortcuts` or `aria-disabled` stale.

The test runs the probe #3342 used. For each public example and
developer page, it makes 40 random presses and fills on visible
controls, in an order seeded by the example's name. After each step it
waits for the page's readiness, for every send to come back, and for
rendering. It then reads every element's `aria-keyshortcuts` and
`aria-disabled`, forces a full key repaint (`paintKeys()`), and reads
them again. It fails on any attribute the repaint changed, naming the
step, the control pressed and the element. The keys themselves still
work when a row is stale, since a press reads the rows afresh, so no
other test catches this.

## The stale row it found

On this PR's first CI run the sweep failed on `code-comparison`. After a
press on a closed tab, the tab strip still named Enter and Space. The
strip's "open the tab" row read `aria-selected` on the focused tab,
which no signal tracks. A person's press focuses the tab on mousedown
and opens it on click, a few frames later. So the strip read the focused
tab while it was still closed, and nothing told it to read again once
the tab opened. `lf-tabs` now holds the open panel in a signal
(`#active`), and the row compares the focused tab with the open one. A
new browser-tier test,
`test_a_pressed_tab_stops_naming_the_key_that_opens_it`, holds the mouse
down for a frame before releasing. It fails on the previous `lf-tabs`
and passes now.

I also put #3342's diff-filter fix back (`lf-diff.js` asking
`:focus-within` directly), and the sweep failed on
`diff-thread-gallery`, naming the diff whose `aria-keyshortcuts` kept or
lost `Escape`.

## Waits instead of the probe's fixed delay

The probe waited a fixed 400 ms. Two of its findings were readings taken
mid-operation rather than stale rows. A live sample's Reset is
`aria-disabled` while its child loads, and the child finished loading
between the two readings. A playground's Build query was `aria-disabled`
until its send came back. The test waits for page readiness, which
counts each sample's arrival, and for `round_trip`, so neither reads as
stale.

## Write-watch findings on the sweep's path

The random presses also met three findings from the write watch, which
this change fixes so the test passes:

- **The merge film** (`examples/wt-merge.page/film.js`) removed every
annotation note and drew it again on each paint. The painter dropped
unseen parts before `#paintNotes` marked the notes as seen; it now drops
them after every layer has painted. The corpus copy is regenerated.
- **The playground's Copy button** wrote the same `data-copy-state`
again when pressed twice within two seconds. It now writes through
`keeps`.
- **Sortable** sets a card's `draggable` to false on every release of
its grip, whether or not the press became a drag. It is vendored, so
`write_watch.js` lists that write in `EXPECTED`.

## Cost

Locally, under load from other sessions, the 28 cases take 202–306
worker-seconds in total over eight runs (about 3.5–5 worker-minutes),
and 66–78 s of wall time on 4 workers. The slowest are `wt-merge` and
`pr-walkthrough`, each up to about 40 s. On this PR's CI run, the 23
cases among the job's 25 slowest tests took 510 worker-seconds,
`file-tree` the longest at 85 s, so the sweep costs about 9
worker-minutes there. It runs one seed; the decision estimated about 6
worker-minutes per seed.

This is Max's decision #31 (option C) on the overnight report.

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