Skip to content

Standardize keyboard destinations and activation - #128

Merged
max-sixty merged 4 commits into
mainfrom
codex/shortcut-navigation
Aug 30, 2026
Merged

max-sixty merged 4 commits into
mainfrom
codex/shortcut-navigation

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Leaf's keyboard registry still had four mismatches after the shortcut changes: the Page map had no direct destination, reader-facing help leaked “Decisions,” reaction declarations could spell Space inconsistently, and a standalone L shortcut duplicated the native Approve button. This adds g M through the shared Page map opening path, standardizes visible naming and activation, hardens the popover focus retry, and leaves approval to the button's native Enter/Space behavior.

Browser coverage exercises wide and compact Page map entry, chord/reference parity, Ask labels, literal Space activation, and approval fallthrough. Local verification passed with 728 tests, 1 skipped, and every pre-commit hook passing.

This was written by Codex on behalf of @max-sixty

# Conflicts:
#	skills/leaf/CLAUDE.md
#	skills/leaf/assets/leaf.js
#	skills/leaf/assets/runtime/living-margin.js
#	tests/test_render_navigation.py
# Conflicts:
#	skills/leaf/CLAUDE.md
#	skills/leaf/assets/runtime/keyboard/address.js
#	skills/leaf/assets/runtime/living-margin.js
@max-sixty
max-sixty merged commit aa25ddf into main Aug 30, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/shortcut-navigation branch August 30, 2026 18:27
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
…ry disclosure row's shortcuts (#132)

## Problem

[Run
33324080398](https://github.com/max-sixty/leaf/actions/runs/33324080398)
failed with 63 tests red on 6794ddc. The group #127 recorded as unfixed
under "The generic CONTROL contract went with the old `offer`" was two
readings that went quiet when
[335bf9a](335bf9a)
moved widget chrome onto native elements. **The `selectableOffer` half
has since landed on `main`**, so this branch is only the other one.

335bf9a gave `lf-options`' settled row a `keys()` scope binding `PRESS`.
[`lineRows`](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/runtime/keyboard/keyline.js#L53-L77)
gives a nearer scope only the bindings it names, so the runtime's
disclosure scope was left holding the arrow alone. Standing on a settled
ask, the key line read `⏎ / space` "open or close" beside a stray `→`
"open" — two chips for one press, and neither saying which way this
section goes.

## Solution

**The row's bindings come from `DISCLOSE`.** [leaf.js's note on that
primitive](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/leaf.js#L2428-L2432)
asks for this by name — "a widget's own row re-wording the same press in
its own terms … named once here so the two cannot come to name different
sets" — and the arrows test asks for it in its docstring too. The line
word follows the row the way the runtime's own does, so the two merge
into one chip. The scope's title and `does` string are untouched, which
is what `test_settled_options_collapse_without_going_out_of_reach` asks
of the "?" reference, and the row states `aria-expanded` at birth so the
pair `DISCLOSE` reads is never briefly incomplete.

**And the shortcuts attribute repaints with it — from the watch, not
from the widget.** A row bound through `DISCLOSE` answers from the
disclosure's own state, and that state is named on two surfaces: the
line the reader sees, and the `aria-keyshortcuts` a listener is read.
Only the line had a watch. `keys()` writes the attribute once at
declaration, so an open group's line read `⏎ / space / ← close` while
its attribute still said `Enter Space ArrowRight` — naming the arrow
that no longer moves the section and withholding the one that does, on
the surface a screen reader gets.

The repaint belongs in the [document's disclosure
watch](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/leaf.js#L467-L486)
rather than in `lf-options`. That `MutationObserver` over `open` and
`aria-expanded` is already the thing that hears both spellings of the
write, in the page and in every shadow root `shadowStage` hands it;
[`paintKeys()`](https://github.com/max-sixty/leaf/blob/0f95be662912bd786bddfed2f52f4b047eb89056/skills/leaf/assets/runtime/keyboard/scopes.js#L174-L181)
is the superset of the `paintHere()` it was calling, and ends in it. So
one call covers every `DISCLOSE` row at once — including the two that
already existed and had no repaint at all, `lf-diff`'s file summary and
`lf-draft`'s edit history, both of which carried the exact defect
described above on a widget this branch does not touch. `lf-options`
drops its own call and the import behind it, and a widget declaring a
disclosure row owes no repaint of its own.

## Testing

On `0d7e0d0` with nothing applied, then on 0f95be6:

| test | `0d7e0d0` | 0f95be6 |
| --- | --- | --- |
|
`test_render_navigation.py::test_the_arrows_say_which_way_the_section_under_the_reader_goes`
| fail — `⏎ / space` "open or close" then `→` "open" | pass |
|
`test_render_anchors.py::test_a_widgets_native_control_names_the_press_the_platform_makes`
| pass — it did not read the attribute | pass, with the two new readings
|
| `tests/test_render_options.py` (whole file, `--run-nightly`) | 1
failed | 1 failed — the same
`test_a_specimen_holds_a_wide_exhibit_inside_the_column` |

Both tests read `aria-keyshortcuts` **once and unretried**, for the same
reason they already read the line that way: the two-second heartbeat
repaints scopes too, so `expect(...).to_have_attribute` goes green on
whichever tick lands inside its five-second budget. Putting the watch
back on `paintHere()` fails both — `'Enter Space ArrowRight' == 'Enter
Space ArrowLeft'` on the settled row, and the mirror of it on the staged
diff summary.

- `uv run pytest tests` — 723 passed, 6 skipped, on the code as pushed.
(The `skills/leaf/CLAUDE.md` paragraph was written after that run and is
documentation only.)
- `tests/test_render_navigation.py` + `tests/test_render_widgets.py
--run-nightly`: 4 failed, 119 passed — the same four already standing on
this branch's previous head.
- `tests/test_render_anchors.py --run-nightly`: 4 failed, 53 passed; all
four reproduce with these changes reverted, so none is this change.
- `pre-commit run --files` over the four touched files: every hook
passes.

Note that `ci` runs only the everyday suite on a pull request, so this
PR's own checks do not exercise any of the browser tests above.

## Still red on `main`, not addressed here

- `test_example_renders[corpus]` now reports `<lf-tab
id=corpus-pr-walkthrough> puts "opens in a new tab" under .lf-ui` — a
different finding, from 26dbf42's external-link treatment rather than
from 335bf9a.
- `test_a_widget_that_renames_its_role_keeps_the_press_offer_gave_it`
asserts the line says "press it" over a tab. That word belonged to the
shared control scope 335bf9a removed, and nothing writes it now —
`lf-tabs` says "open the tab" in its own scope. Restoring a generic
press is a decision about what the layer owes every control, and #128
stands closest to it.
-
`test_site.py::test_the_public_catalog_is_a_visual_index_of_full_page_routes`
— the preview digest, diagnosed in #133. This branch touches no preview
input.

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33324080398)

---------

Co-authored-by: leaf-agent <[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