Skip to content

Name a notice's keys only through its press - #6687

Merged
max-sixty merged 9 commits into
mainfrom
notice-keys-follow-binding
Nov 22, 2026
Merged

max-sixty merged 9 commits into
mainfrom
notice-keys-follow-binding

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Four panel notices wrote their keys into their words: "2 changes since v1 — v shows them", "Annotations hidden — o shows them", "Edit discarded; g D restores it" and "Draft kept — g i resumes writing". Nothing checked those keys, so a phone showed v, and the discard notice named g while the caret sat in the reply box, where g types a letter. Now a notice names an action only through press, which the panel field's end shows with the keys that would make it now (keyboard/control-keys.js, commandKeysNow).

This PR also takes the best of #6685, which converted the same four notices; Max asked for the merge and for the rules on how long words stay to be easy to change. What a reviewer should weigh:

Max asked for this in a Claude Code session; a separate Claude Code reviewer read the earlier rounds. Tests: test:runtime, check:browser and the affected browser tests pass; the new retention tests fail with the rule reverted.

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

Four notices wrote their keys into their words, where nothing checked that the
key would work. "2 changes since v1 — v shows them" showed v on a phone, and
"Edit discarded; g D restores it" named g while the caret sat in the reply box,
where g types a letter. "Annotations hidden — o shows them" and a refused send's
"Draft kept — g i resumes writing" did the same. The panel field's end already
showed a press only with keys the dispatcher would answer now. The notices went
around it because offering a press made a notice stand until the next input,
which the user had rejected for news.

A notice now points at a press only through `press`, and whether it stands
until the next input is the caller's `holds`, separate from the press. The
field's end and the live region say the press with the keys that would make it
now (keyboard/control-keys.js, `commandKeysNow`, `spokenKeysNow`, `pressWords`),
or its word alone on a touchscreen. News of changes since the version last seen
offers Show changes, hiding the annotations offers Show annotations, and a
discarded rewrite offers Restore edit. Each passes after a notice's moment, as
their words did. Next thread after a Resolve, Resume writing after Draft kept,
and Undo still hold until the next input. A refused send's error says "Draft
kept" alone, since an error offers no press; Threads' Drafts, t and g i reach
the words.

While the pointer rests on the panel, a field's end keeps whatever press it
showed until the next input or until the pointer leaves (floating-panel.js,
`steady`). That was a hold for the page's own press, Open latest or Next On Me,
and now covers a notice's press passing too, while the press can still act. A
notice's press still appears with its notice.

Removed: the panel's private `keysNow`, dispatch.js `activeCommandLabel`, and
the annotation layer's own touchscreen branch.

Behavior the tests now record:
- test_changes_in_place: the live region hears "… . Show changes v", and a new
  touchscreen case shows and hears "Show changes" with no key.
- test_a_toggle_s_notice_shows_only_where_no_standing_words_say_it: "Annotations
  hidden · Show annotations o", and a click on the press shows them.
- test_sending: a refusal reads "… refused before append. Draft kept".
- test_a_discarded_rewrite_comes_back: Restore edit shows only once the caret
  leaves the reply box, where g D works.
- New: test_a_press_at_the_field_s_end_stays_under_a_resting_pointer;
  test_a_refused_resolve_takes_next_thread_from_under_the_pointer;
  tests/runtime/notices.test.mjs, for which presses pass with their notice;
  and a field-readings case where news with a press leaves an error in front.

@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.

#6685 (resume-writing-hint) is open and makes the same change. It converts the same four notices ("o shows them", "v shows them", "g D restores it", "g i resumes writing") into presses, and it edits notifications.js, floating-panel.js, keyboard/control-keys.js, since-seen.js and message-edit.js. Only one should land, and the two make different product choices, so the maintainer has to pick:

  • How long a notice holds. Here, "Annotations hidden" passes after its moment, and a resting pointer keeps whatever the field's end shows (steady). In #6685 it holds until the next input, and only the page's own press stays put under the pointer.
  • What a listener hears. Here, the announcement uses the keys that work at that moment, so "Edit discarded" is spoken without a key while the caret is in the reply box. #6685 announces the command's full shortcut wherever the caret is ("Restore edit, g Shift+d").
  • Extent. #6685 also gives errors a press, so a refused send offers Resume writing and doesn't just say "Draft kept". It also adds an architecture/spelled-keys lint that rejects keys spelled into words, so this form can't come back. This PR has neither.

This PR's code reads as correct to me, and pnpm run test:runtime passes at this head. One cleanup if it's the one that lands: noticePress no longer exists, but two comments still point to it. They are the comment above pressCommand in keyboard/dispatch.js and the one above the per-frame press recheck in composing/input.js ("A box's press stands only while a key of its would make it"). Both should now point to notifications.js, pressReading.

While the pointer rests on the panel, the field's end keeps the press it showed
past its notice's moment (floating-panel.js, `steady`), meant to last until the
pointer leaves or the user's next input. The hold read the input count only
when the panel painted, so an input that painted nothing in the panel, such as
an arrow key scrolling the page, left it standing: after news passed, the field
kept "Away · Show changes v" through ArrowDown until the pointer left. The
session working on #6685 found it.

Now the user's next input repaints a held field's end. An input on the held
press itself is that press being made, which a paint would take from under its
click, so it keeps the hold, as it keeps a holding notice (notifications.js,
`pressesNotice`, which both now ask).

Tests: test_news_s_press_stays_under_a_resting_pointer_until_the_next_input is
new and fails without the change; the resting-pointer test now also clicks the
held press, which fails without the exemption.
…ar words

The user decided that a press's word alone at the panel field's end, as a
touchscreen showed Show annotations, Show changes, Open latest, Next On Me or
Next thread, reads as status rather than a button, and that the panel's menu and
lists are a finger's route to each. So the end shows a press only with keys that
would make it now, and a touchscreen is shown none (control-keys.js,
`commandKeysNow`). This reverses #6483's word-alone press for a finger. A notice
about where the user stands, such as "Annotations hidden", leaves the page field
to its standing words wherever its press doesn't show, a touchscreen included.

The user also asked that Leaf leave to the browser what it can of speaking keys.
The live region hears a notice's words alone again, as before this branch, and
a screen reader meets the press as the button it is, its key inside. Gone:
`spokenKeysNow`, `spokenNotice` and `pressWords`, whose one remaining use the
box now spells itself.

Tests: the news and annotations tests expect the live region to hear the words
alone; the touchscreen news test now sees no press and reaches Show changes from
the menu; a new test hides the annotations on a phone and sees the standing
words with no press.

@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 PR description no longer matches the diff. Merging squashes with it, so it would become main's commit message. It still says one reading in keyboard/control-keys.js (commandKeysNow, spokenKeysNow, pressWords) gives the live region a press's keys, and gives a touchscreen the press's word alone. Since 782f69f, spokenKeysNow and pressWords are gone. The live region hears the notice's words alone. A touchscreen gets no press at the field's end; the panel's menu and lists reach each press's result instead. The "Worth weighing" and Tests paragraphs should also mention the new hold-ending input (dbc7b6d) and the touchscreen tests that replaced test_on_a_touchscreen_the_news_names_no_key. Could you rewrite the description to match the current diff?

The user asked for the best of this PR and #6685, which converted the same four
notices, and for the rules on how long words stay to be easy to change, since
they mean to replace them with a better guess at what the user still needs.

So how long a notice stands is one rule in one place (notifications.js,
`showNotice`), taken from #6685: every notice stands its four seconds; one
answering the user's own gesture with a press, or an undo's, then stays until the
user's next input, and an input within its time doesn't end it; news passes with
its press. Callers no longer choose: `holds` goes from Next thread and Resume
writing, which stay by the rule, and stays only for an undo's notice, which has no
press. "Annotations hidden" now stays until the next input after its time, and
after a discard, the Escape that leaves the reply box shows Restore edit rather
than ending its notice. The field's error yields to a gesture's notice with a
press, read from whether the notice is news rather than from `holds`.

The pointer hold goes back to the page's own press, Open latest or Next On Me,
as on main (floating-panel.js, `pagePress`): a notice's press comes and goes with
its words, which say why the field's end changed, and a gesture's stays until the
next input anyway. Gone: `steady`, a press's `stands` at the field's end, and the
input watch that ended the general hold.

Not taken from #6685: an error's press (Resume writing on a refused send, and a
press in the Errors list), a mechanism for a rare path whose words Threads'
Drafts and `g i` already reach; the `architecture/spelled-keys` lint, which
catches one form of a key written into words; and the spoken shortcut, since the
live region now hears words alone.

Tests: the runtime notice test covers the rule; a browser test sees Show
annotations stay through an input within its time and go at the first after;
news's press goes with its words under a resting pointer, as #6685's test had it.

@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.

Two places still describe the hold this commit changed:

  • The page's press no longer updates at the next input (inline). Neither the code nor its comment matches main any more.
  • undo.js's header still says the undo's notice "stands until the user's next input rather than for its time (notifications.js, holds)". Under showNotice's one rule, an undo's notice now stands its time first, and inputs within that time don't end it. That header records the user's decision on the hold, so it should state the new rule. It is outside the diff, so I couldn't suggest the edit inline.

Comment thread browser/runtime/floating-panel.js Resolved
… words

The user had said yes, on #6685, to errors that carry a press and to a lint rule
against keys spelled in Leaf's words; the previous commit left both out, which
reversed that yes. This restores them.

An error about no text field may offer the press that recovers from it
(errors.js, `press`): a refused send whose words went back to a box out of view
offers Resume writing (drafts.js, `keepRefusedWords`). The panel field's end
shows it after the error's words with the keys that would make it now, and the
Errors list offers it beside Dismiss. A field reading whose words come with a
press now names it (field-readings.js, `press`), so the end offers a notice's
press and an error's the same way, in place of a branch for notices alone.

`architecture/spelled-keys` (eslint.config.mjs) refuses a string that spells a
key after a dash or a semicolon and then a verb, the form the four notices
used. It reads that form, not every way of writing a key; `announce` calls are
exempt.

Tests: the refusal tests see Resume writing at the field's end and run it from
the Errors list; runtime tests cover what the lint refuses and admits.
The rule let any string inside an announce() call spell a key, since #6685's
spoken shortcut did. Nothing on this branch needs that: no announcement takes
the dash-or-semicolon form, and the follow-up Max chose reads every announced
key from the register (keyboard/scopes.js, saying). Its message now names
saying as an announcement's way to say a key.
…s hold

Tend's review of 13e4251: undo.js's header still said an undo's notice stands
until the next input rather than for its time; under showNotice's rule it stands
its time and then until the next input.

It also asked whether the page's own press, held under a resting pointer, takes
a change at a key that paints nothing in the panel. The hold is main's; a new
test empties On Me under a resting pointer and finds ArrowDown takes Next On Me
away, with or without a repaint on input, so no repaint is added.
@max-sixty
max-sixty merged commit e949c55 into main Nov 22, 2026
8 checks passed
@max-sixty
max-sixty deleted the notice-keys-follow-binding branch November 22, 2026 02:15
max-sixty added a commit that referenced this pull request Nov 22, 2026
Tend's review of #6702 found two answers to whether a key would make a command now:
`pressRuns`, which resolves a synthetic press through `resolveKey` for an
announcement, and `activeCommandBinding`, which walked the stack through
`commandMatching` for a notice's press and the composer's placeholder (via
`commandKeysNow`, from #6687). The walk approximated Escape's order with
`unclaimedScopes`, so the two could disagree and a fix to one would miss the other.

`activeCommandBinding` now takes each binding of a row in the user's scopes that
declares a wanted id, and keeps it where `pressRuns` holds. `invocationNow` is the
one reading under both and under `escapeInvocation`. `commandMatching` keeps only
its use by the reference (`commandFor`, behind `executeCommand`), which asks a
different question: whether the command runs from the reference, where a disabled
shortcut still leaves it executable.

`commentRows` in target-picker.js stays: `saying` names rows, with their titles, and
the page's `c` row is declared inside surface.js's setup, so a chosen search match
finds it by id.

Tests: the saying runtime test also checks `activeCommandBinding` drops `g` where a
nearer scope takes it; test:runtime, check:browser, and 15 browser tests covering
notice presses, the composer placeholder, Go-to, Draw mode and page search pass.
leaf-agent added a commit that referenced this pull request Nov 22, 2026
…ose (#6717)

`test_a_coarse_pointer_keeps_useful_status_without_keyboard_hints` has
failed on main since #6687. That change made a touchscreen show no press
at the floating panel field's end, because the maintainer judged that a
word alone there reads as status, and the panel's menu and lists already
reach each press. The test still expected a notice on a coarse pointer
to read `Saved · Next On Me`. The page now shows `Saved`, as #6687
intended, so this PR changes the assertion to the notice's words alone
and checks that no `.lf-compose-press` is drawn. #6687's own
`test_on_a_touchscreen_hiding_annotations_offers_no_press` makes the
same check. No product code changes.

The test fails on `b54a16fc4` (current main) with the placeholder
reading `Saved` and then the panel's status, and it passes on this
branch.

The same CI run,
[44977598913](https://github.com/max-sixty/leaf/actions/runs/44977598913),
had four other failures. All four were seated-thread tests that #6713
fixed, and #6713 merged after that run's commit.

Refs #6716 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 22, 2026
…ce (#6722)

Three evals had drifted from the code they test. This brings each back
in line.

- **`control-legibility` couldn't start.** `views.py` exits when
`actions.json` and `ACTIONS` in `browser/runtime/icon-paths.js`
disagree. #6679 and #6687 added four presses to `ACTIONS`
(`resume-writing`, `restore-edit`, `show-annotations`, `show-changes`)
that `actions.json` didn't have. Each now has a line saying what
pressing it does, taken from the notice that offers it (`drafts.js`,
`thread/message-edit.js`, `annotation-layer.js`, `since-seen.js`). A
Node comparison of the two key sets now comes back empty.
- **Two rubrics failed pages that follow the shipped guidance.**
`proposals-get-individual-decisions` (`recommendation-markers`) and
`options-stay-words-for-wording` (`comparison-labels`) still asked for a
"recommended small.lf-tag". Since #6289, the advice marker is the
`recommended` attribute on the `lf-option`, which draws the badge;
`authoring-on-me.md` and the `lf-option` registry entry both teach it.
#6715's rename to `lf-tag` carried the stale requirement forward. Both
rubrics now ask for `recommended`. This only corrects a fact, so there's
no instruction scoring. The header of
`proposals-get-individual-decisions` still calls compact recommendation
markers a known failure, and that may have been this mismatch; the next
run of the case will show whether it holds.
- **`evals/README.md`** still described the JavaScript assertion that
#6681 replaced. Complete authoring tasks now grade with the Python
assertion `regrade.py:authoring`.

No regression test is added. `views.py`'s own startup check is what
reports `actions.json` drift, and a suite test would charge every new
icon action for an experiment. `dev/tests/test_evals.py` passes and both
case files parse.

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

Leaf's screen-reader announcements wrote some keys into their words by
hand, where nothing checked them against the bindings or against where
focus was, and Draw and Design branched on a touchscreen to say "Exit
Draw mode leaves." instead. Each now reads its keys through `saying`,
the reading Go-to and reactions already used, which this PR moves beside
the key chips' reading in `control-keys.js`: it names a key only where
resolving that key as a press now would run the row (`pressRuns` in
`dispatch.js`), and a touchscreen hears none, as it is shown none.

| Announcement | Before | After |
| --- | --- | --- |
| Draw mode on | …each stroke adds to one drawing, and z takes one back.
Escape leaves. | …each stroke adds to one drawing. w or Escape exit Draw
mode |
| Design mode on | …a picture. Escape leaves. | …a picture. l or Escape
exit Design mode |
| Select mode | Choose a target — press an element, type one of 9 hints,
or press Tab to hear targets and Enter to choose. Press slash to search
the page. | Choose a target — press an element; 9 visible targets. a–z
type hint, Tab or Shift+Tab browse hints, Escape close picker, / search
page |
| Search match chosen | …Selected. Press n for next, Shift+n for
previous, or c to comment. | …Selected. n or Shift+n next / previous
match, c comment on the selection |
| Heard hint | Hint a: …. Press Enter to choose. | Hint a: …. Enter
choose target |
| Go-to | Go to — 3 visible targets; type a hint or press Tab to hear
them. p page, … | Go to — 3 visible targets. p page, … |
| Any of these on a touchscreen | Draw, Design: "Exit Draw mode
leaves."; the rest named keys | The words alone |

To weigh:
- The keys a notice's press and the composer's placeholder name
(`activeCommandBinding`, behind #6687's `commandKeysNow`) now come from
the same reading: each key is resolved as its press (`invocationNow`,
which `escapeInvocation` reads too) in place of a second walk of the
stack that approximated Escape's order, which Tend's review found could
disagree with an announcement. That walk remains only for running a
command from the command reference.
- The words are terser than the hand-written sentences, in `saying`'s
"key title" form. A mode's two ways out are said once, under their
shared title ("w or Escape").
- "z takes one back" is gone rather than moved: after the first stroke
the drawing's composer has focus and takes `z`, so no announcement can
truthfully offer it.
- The repeat-search row's title is now "next / previous match" (was
"search matches"), which the command reference shows too.
- On a tablet with a keyboard attached, Go-to, reactions and the board's
grab now say no keys, though their chips still draw.
- `announce` now also takes a function, read as it speaks 30 ms later.
Resolving keys in the keydown itself forced a 5 ms layout right after
Draw mode changed the page; read later, keydown plus frame measures w
10.5 → 11.1 ms and g 19.9 → 19.6 ms on `docs/how-it-works.html`, base to
head. A page listening for `lf-announce` can now receive a function in
`detail`; the module reference says so.

Max chose this on the Leaf page for #6687, over keeping the words or
dropping the keys. Tests: `test:runtime` (saying follows the dispatcher
and says nothing on a touchscreen), `check:browser`, the 11 browser and
journey tests whose words changed; the table is from `leaf-dev probe
--base` on `incident-report`, desktop and `--touch`. Codex reviewed it
three times; the fixes for its findings are in.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
…the panel (#6796)

A thread about a passage can now be read beside the passage, as before
and by default, or in the floating panel, and a card's Open in panel and
the panel's Show on page switch between them. Until now each route
picked a reader by the thread's kind, so a thread moved into the panel
came back as a card on the next `t`. One setting, kept for the tab, now
decides every route to a passage's thread: `t`, a press on the passage,
Threads, On Me, a `?thread=` link, Resolve's move to the next thread and
Undo. The panel's `reveal` takes the thread or declines it by the
setting, and the margin draws no card under the panel setting
(`thread/threads-in-panel.js`).

- Each switch raises a notice, "Threads open in the panel" or "Threads
open beside their passages", whose `p` switches back and moves that
thread back.
- Under the panel setting, a route scrolls the passage into view above
the panel, only as far as needed. `landing-scroll.js` judges what the
panel covers by where its opening animation ends, and history adds a
Back step only where the page moves.
- Placements Leaf forces, such as a thread about the whole page, a
resolved thread, a passage the page doesn't draw or a window too narrow
for cards, put the thread in the panel without changing the setting.
- Undo no longer records which reader a thread was settled in
(`settled.reader`), since it reopens the thread by the route.

To weigh: a switch lands on the thread so its notice shows, unless the
user was writing in the reply, where the caret stays. On a touchscreen
the notice shows no press, following the rule from #6483 and #6687; a
finger switches back with the thread's own button. The Back/Forward pull
request, #6799, also changes `anchor-travel.js` and `floating-panel.js`,
so whichever lands second will conflict there.

Max asked for this. A blind UX review shaped it: the page still scrolls
under the panel setting, the notice offers the way back, forced
placements leave the setting alone, and one setting decides every route.
A fresh agent used it in Chromium and Firefox, and Codex reviewed it
twice; their findings are fixed. Tests:
`tests/browser/threads/test_threads_in_panel.py` is new, tests that
opened a passage's thread in the panel from Threads now choose the panel
first, and `test:runtime` and `pnpm run check` 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