Repository navigation
Route keyboard commands through focused scope ancestry - #586
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Two regressions on the new focused-ancestry seam. Both reproduce against the merge base (f03af1d4), and neither is visible to this PR's CI: test_render_navigation.py and test_render_widgets.py are nightly-marked, so the test job runs neither. The duplicate-presentation case 08e10d88 just fixed was a third — I confirmed test_the_key_line_keeps_local_and_page_hints_and_progressively_reveals_the_rest is green again at that head.
A dead element-scope Escape declaration leaves the reader with no way out. For every other key an unavailable inner declaration only suppresses the outer Leaf meaning and the browser default survives, which is the trade the note argues for. Escape has no browser default, so the press does nothing at all and the return frame it was going to unwind stays standing — and the shortcut bar goes quiet with it, since lineOwner("Escape") reads the same claims. Both shipped scopes in that shape are reachable: targeting.cancel-selection (when: () => this.#armed) is registered on the <lf-targeting> element itself, so an unarmed workbench claims Escape for anything focused inside it, and board.cancel (when: held) does the same on a resting grip. Reproduced with an inner scope declaring keys: ["Escape"], when: () => false inside a command's return frame: the layer closes on Escape at the merge base and stays open on this branch. That contradicts the note's own "one press unwinds one layer". I ran test_render_navigation.py and test_render_widgets.py with the suggested filter and it adds no failure.
aria-keyshortcuts promises keys that do nothing where the reader stands. Splicing intrinsicBindings into the projected shortcut bypasses the reachableActionRoutes() filter the digit goes through — the comment above the paint is explicit that a digit must never stay promised once a nearer layer has taken it, and the intrinsic keys now get exactly that exemption. Two shipped cases, both measured on this branch:
SWIPE_PAGE, pressato stand on the Ask:.lf-swipe-passreadsaria-keyshortcuts="ArrowLeft 1".1advances the queue from 4 to 3; ArrowLeft leaves it at 4, because the deck's scope is not in the focused ancestry. At the merge base the attribute readArrowLeftand the press worked.test_numbered_ask_routes_follow_replaced_controls, with the Save button focused: the PR pinsaria-keyshortcuts="Meta+Enter Control+Enter 1", but the draft scope is registered on the textarea rather than on Save, so it is out of reach there — the shortcut bar in that same assertion says1–2 / Save / Canceland nothing about⌘⏎. Pressing1closes the editor; Meta+Enter and Control+Enter do not.
availableCommandRoutes() already answers this per row, so keeping only the intrinsic bindings present in routes.get(routedCommand(route).row) drops both. That reduces the attribute to 1 in each case, so the assertion above wants updating with it.
For the record, test_an_ask_arrival_starts_with_the_context_that_frames_it, test_a_tall_local_comment_survives_its_panes_posture_and_return, and test_the_register_is_the_only_way_a_key_enters_the_runtime also fail here, but they fail at the merge base too — not this branch's.
…board # Conflicts: # skills/leaf/assets/leaf.js
Leaf's page bindings previously remained reachable through focused widgets unless a broad native claim intercepted them, while Ask reused package bindings and copied invocation behavior into its own action map. That made ownership depend on liveness and let the projection drift from the command it represented.
This resolves element scopes through focused ancestry. A focused widget owns only the executable bindings it declares: an unavailable ordinary declaration retains that ownership,
Escapecontinues to the next live semantic unwind, and undeclared bindings and presentation-only rows continue outward. Ask assigns every live Decision an independent1-9alias and keeps a scoped reference to the original command, so widget bindings, Ask aliases, the shortcut bar, accessible shortcuts, and the command reference share one invocation contract.Accessible shortcut projections now include only routes reachable from the current focus, including every equivalent intrinsic binding that remains after partial shadowing. The package and runtime references document the resulting seam, and browser coverage exercises dead-command shadowing,
Escapefallback, multi-binding commands, intrinsic widget keys, Ask aliases, return frames, replaced controls, and native controls.