Skip to content

Leave letters to page menus, trees and comboboxes that type ahead - #6469

Merged
max-sixty merged 2 commits into
mainfrom
page-widget-letters
Nov 19, 2026
Merged

max-sixty merged 2 commits into
mainfrom
page-widget-letters

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Focus on a page widget whose ARIA pattern types ahead (a menu or menu item, a tree or tree item, a listbox, a select-only combobox, or anything inside role="application") now keeps the letters and digits typed there, as a select and role="option" already did. Leaf's page letters work again once focus leaves the widget; punctuation such as ? and modified presses stay Leaf's. The claim sits in nativeClaimAt beside a radio's arrows, rather than widening takesLetters, which eleven modules read as "a letter is a keystroke here" and which also yields Enter and the caret keys.

Before, d in a page menu paged the document and t walked threads, while unbound letters reached the menu. Leaf's own file tree had the same split: q on a row opened the tree's search, d paged the document. Now every letter and digit reaches the widget, so typing on a tree row always searches it.

To weigh: Leaf's page letters wait while focus is in such a widget, g among them, so Go-to no longer arms from inside a page menu (the key-scope test now arms it from the menu's trigger). Inside role="application" that covers c and the walks too, since the role says the application takes the keyboard whole.

Max picked this on the key-reading review page; the branch is merged with main after #5966. Tests: a page-menu subtest in test_key_scopes.py and a tree-row search check in test_render_files.py, both failing without the claim; test:runtime, check:browser.

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

Focus on an element whose ARIA pattern types ahead (a menu or menu item, a tree or tree
item, a listbox, a select-only combobox, or anything inside role="application") now
claims the letters and digits typed there, alone or shifted, so the widget moves to the
item whose name starts with them, as a select and role="option" already did. Leaf's
page letters work again once focus leaves the widget. Punctuation such as ? and every
modified press stay Leaf's.

Behavior that changed: on main, d in a page menu paged the document and t walked to
the next thread while a, which Leaf binds to nothing, reached the menu's typeahead.
Leaf's own file tree had the same split: q, Shift+d and 1 on a row opened the tree's
search with that character, while d and t ran Leaf's page commands. Now every letter
and digit there reaches the widget. Max chose this on the key-reading review page; NVDA
passes keys through for menu, list and tree items, and the ARIA practices recommend
typeahead for listbox, tree and select-only combobox and allow it for menus.

The claim is narrower than takesLetters, which eleven modules read as "a letter is a
keystroke here" and which also yields Enter, arrows, Home and End; those keys already
reach the page's own elements before Leaf reads them.

Tests: the key-scope test gains a page menu whose d moves to Duplicate with no Leaf
command run and whose ? still opens the reference; the file tree test presses d on a
row and reads it in the tree's search. Both fail without the claim.
leaf-agent
leaf-agent previously approved these changes Nov 19, 2026
…etters

Both branches rewrote the key-reading sentence in page-behavior.md and keyboard/AGENTS.md;
the resolution keeps #5966's wording and adds this branch's sentence on widgets that type
ahead after its first sentence.

Behavior that changed with the two together: g in a page menu is now the menu's letter,
so Go-to no longer arms from inside one. The key-scope test that armed Go-to over an open
page menu now arms it from the menu's trigger, and still checks that Go-to's Escape
closes it before a page listener on the window hears the key.
@max-sixty
max-sixty merged commit 9e0abcc into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the page-widget-letters branch November 19, 2026 04:01
max-sixty pushed a commit that referenced this pull request Nov 19, 2026
`test_file_tree_reads_standalone_data_without_a_diff_package` fails
deterministically on `main` since #6469, which first failed in [run
44455882413](https://github.com/max-sixty/leaf/actions/runs/44455882413)
(`9192a5041`). #6469 gives letters typed in a type-ahead widget to that
widget, which Max chose on the key-reading review page. So `c` on a
selected file-tree row now types into the tree's search. The test still
pressed `c` on the row and waited for the composer, a step #3556 added
when Leaf took shortcut letters ahead of the tree. The wait times out.
The `c` it types also filters `README.md` out of the tree, which would
break the steps after it.

This PR removes that step. #6469's own check in
`test_render_files.py::test_a_file_tree_opens_each_file_the_editor_holds`
covers the new behavior: a letter on a row searches the tree. The test
keeps its subject, which is the tree reading standalone data and keeping
its selection and search across a data change. No product code changes,
and nothing of #6469's intent is given up.

Verification: the test passes on #6469's parent (`9e0abccb9^`) and fails
on #6469 and on `main` (`c5ccb1183`) with `.lf-composer leaf-text` never
focused. With this change it passes, and so does
`test_a_file_tree_opens_each_file_the_editor_holds`.

Refs #6418 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 19, 2026
…e stale references (#6492)

This PR removes two pieces of dead code and corrects three stale
references found in the nightly review. No behavior changes.

- **A walk's unread `list`:** `browser/runtime/walk-declaration.js`
stored `list` on the current walk, but `walkPosition()` never returns
it. Its only consumer, `walk-position.js`, takes the list from the
`lf-walk` event's detail instead.
- **`elementBorderFrame`** (`browser/runtime/element-frame.js`): its
comment described it as "for consumers cloning its computed
presentation", but it is private to `elementFrame`. It also read
`shownBox` a second time. It now takes the box `elementFrame` already
read.
- **A panel class nothing draws:** `PANEL_SAYS` in
`dev/leaf_dev/browser.py` and the arrival-notice wait in
`tests/render_harness.py` looked for `.lf-fp-context`. That is a line
over the field that nothing in `browser/` draws any more. `PANEL_SAYS`
is shared by the suite's seat reads and, since #6439, by `leaf-dev
words`. A notice now shows only as the empty field's placeholder
(`data-lf-says="notice"`) or in the leaf's peek. Both selectors already
read those, so the dropped branch never matched.
- **`notes/dependency-candidates.md`** said Leaf takes printed letters
ahead of a page menu's typeahead. Since #6469, a menu, tree, listbox or
select-only combobox keeps them.
- **`browser/runtime/change-provenance.js`** cited `../SOUL.md`, which
doesn't resolve from `browser/runtime/`.

**Verification:** the browser type check and the walk, frame and
provenance runtime tests pass. The pre-commit hooks pass apart from
eslint, which couldn't load in this worktree, so CI runs it.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 19, 2026
…here a control types no letters (#6515)

The render gate's typed-box journey fails on every page with a file tree
(`file-tree`, `file-tree-input`, `deploy-config`) since #6469. The
journey's `into_the_page` helper picked the control to comment on by
"takes no letters" (`!takesLetters(at)`). But #6469 gave letters to
typeahead widgets through `nativeClaimAt` and left `takesLetters` as it
was, so the helper stopped on a tree row. There `c` now types into the
tree's search. The journey typed its words there (`"cW" in input …
lf-file-tree`) and reported `the comment on an item scrolled to the end
and back is gone`.

The helper now asks the dispatcher whether `c` reaches `comment.create`
at the focused control (`availableCommandRoutes`). That is the reading
the keyboard itself acts on, so the helper tabs past any control that
keeps the letter. #6469's behavior stays as Max chose it. Only the
test's way of finding a comment target changes, and it no longer
duplicates part of the dispatcher's rule.

Verification: `test_page_fixture_renders[file-tree]`,
`[file-tree-input]` and `[deploy-config]` fail on `dd38dcb16` with this
run's diagnostic, and pass with the change. Six other
`test_page_fixture_renders` pages pass with it too, including
feature-gallery, pr-walkthrough and the diff pages.

Refs #4225 — automated triage

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

Leaf read printed letters in a capture listener ahead of page code, so a
widget that wanted one of Leaf's letters had to register it through
`lfCommands`. This moves letters to where Leaf already reads every other
key, after the listeners on the focused element and around it: with
focus inside an element, its own listener hears every key first, and
`preventDefault()` claims it. Leaf hears first only in states of its
own: armed Go-to or reactions, focus scrolled out of sight, and a key
aimed at the page itself with nothing focused. Registering keys stays
the route to the `?` reference, hints, `aria-keyshortcuts` and
`contextKeys` forwarding. A prevented key counts as its author's inside
any authored document, the page's body or a thread message's body, read
from the event's path, so a widget in a message, or one that redraws on
its key, keeps it.

To weigh: SOUL's "Leaf's keys work the same on every page" now bends
inside a widget that takes a key, as #6469 bent it for menus, and `?`
still lists Leaf's meaning for a key a widget takes without registering
it.

`module-input.md`, "How scopes compose", now holds the order an author's
listener meets; `page-behavior.md` points there. A new eval case,
`page-wide-keys-take-no-leaf-keys`, passes 4 of 4 on main's text and on
this branch's.

max-sixty chose this contract on the review page; Codex reviewed it over
three rounds, and each finding is fixed here.

Tests: runtime suite (1,083), plus the key-scope, draft-key,
interaction-layer, On view and Versions key tests (234), including a new
test for a widget in a thread message.

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