Repository navigation
Keep a native control's Enter and Space from the scopes around it - #2567
Merged
Merged
Conversation
…round them Native activation (Enter on a link, Enter or Space on a button) now belongs to the focused control in the keyboard register, the way text entry already did. No scope around the control runs a Leaf command on that press; a row that only names it, such as a link's Follow, still names it on the shortcut bar. The code block's Copy no longer needs element scopes' `at` option to leave a nested link its Enter, so `at` on element scopes is deleted. A contextual alias of Enter or Space on a native button is no longer projected into aria-keyshortcuts, since it no longer fires. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Since #2558, Enter on a code block copies it and its copy control stays out of the Tab sequence, so the sweep's Enter route never focused the control and the test failed on main. The control's ring is no longer a keyboard state to sample. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A scope rooted at the focused control speaks for it, so a page disclosure's toggle keeps Enter and Space and its name on the bar, as before; a row clicking the focused control is that control's press. A contextual alias on the control still yields, so dispatch and aria-keyshortcuts agree. Native activation now also covers a <summary> (Enter, Space) and a checkbox or radio button (Space), and page.js's link scope reads the rule's link selector. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/keyboard/AGENTS.md
leaf-agent
approved these changes
Oct 12, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
version.js conflicted only in its imports: this branch's rendering and arrivals imports for continuity, and #2568's readingPaint for comparison watchers. Both kept; the rest merged cleanly. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 12, 2026
The [main CI run](https://github.com/max-sixty/leaf/actions/runs/38235572771) also failed the visual-part reaction test's assertion that Space clicks a button on keydown. [#2567](#2567) intentionally gave a focused button its native Space activation, which clicks on keyup. This PR presses Space normally and keeps the test's checks for the send, announcement, visual anchor, and replay. The old assertion fails on current `main`; the corrected test passes with the comparison case in a focused local run (`uv run pytest -q -n0` with their two node IDs). Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the keyboard register, native activation now belongs to the focused control the way text entry already did. A scope declared on a container could take Enter or Space from a link or button inside it: with a container scope binding Enter, Enter on a nested link ran the container's command and suppressed the browser's follow. #2558 hit this with the code block's Copy and worked around it with an
atoption on element scopes. That option is deleted here, since nothing else used it.What changed (Lit follow-up review, item 64)
nativeActivationAt(keyboard/text-entry.js) names the platform's activation press at the focused control: Enter on a link; Enter or Space on a button, a button-type input or a<details>summary; Space on a checkbox or radio button. Unmodified presses only. No scope around the control runs a different Leaf command on that press. A row that only names the press, with nothing of its own to run, still names it: a link's Follow, or the versions menu's "open that version". A mode that owns the keyboard (Go-to, reactions, Page Map) still stands nearer, as before.controlis the focused element all keep the press. A contextual alias on the control yields, as it yields to native editing, so dispatch andaria-keyshortcutsagree.shadow().takesnow receives the row and its scope at every call site (dispatch,lineOwner, reference reachability, the shortcut bar'slineRows), so the bar never shows a row that the dispatcher would withhold. A container's Enter that activation took makes no claim further out, so "On a link" still names Follow inside a code block.atoption (keyboard/scopes.js), its reading incommand-reference.js, and its use incode-copy.js.Hand-written source: +97 / −45 lines (
text-entry.js,dispatch.js,scopes.js,command-reference.js,shortcut-bar.js,page.js,touch-controls.js,code-copy.js), most of it comments. Tests: +120 / −18.Tests
tests/runtime/native-activation.test.mjsfails onmain: Enter on a link inside a container ran the container's command. It checks a container scope binding Enter and Space around a link, a button and a disclosure button: the dispatcher's answer, the preserved default, and the row the bar names. It also checks that a contextual Enter/Space alias on a button yields in both dispatch andaria-keyshortcuts.command-controls.test.mjsused Enter as an incidental context alias on a button. It now uses a digit, the only kind any widget declares.test_each_sampled_focus_ring_is_shown_whole_in_its_surfacefailed onmainsince Declare a code block's Copy through the keyboard register #2558. Enter on a code block copies, and the copy control is out of the Tab sequence, so the sweep's sample of the copy control's ring is dropped.Checks
npm run test:runtimepasses.test_render_controls.py. Two tests still fail, and neither comes from this change:test_primary_reader_revision_replaces_owner_without_losing_thread_draftfails the same way onmain("The page already has a Thread presentation" fromdom-move.js).test_code_copy_enter_leaves_nested_links_usablepasses alone but failed under suite load, on its count of visible copy controls at presentation, not on keys.