Skip to content

Make Ask text entry one keypress away - #63

Merged
max-sixty merged 20 commits into
mainfrom
codex/ask-keyboard
Aug 27, 2026
Merged

max-sixty merged 20 commits into
mainfrom
codex/ask-keyboard

Conversation

@max-sixty

@max-sixty max-sixty commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Selected Asks land on their first option mark, but reaching the field for an unlisted answer required tabbing through every option.

This change gives the option scope a direct split: Enter focuses the selected Ask's own visible page or thread text box, 1–9 toggle numbered options, and Space toggles the focused option. Pick marks expose checkbox semantics and aria-checked, so the accessibility role matches that keyboard behavior instead of promising button activation on Enter. When Enter opens a page-owned box, Escape returns to the originating option mark. Thread reply boxes keep their existing Escape-to-thread behavior.

The clarification-thread regression now uses the reachable production shape: a reader option carries its version-response contract, while a separate agent clarification owns the page-seat reply box. This proves Enter does not borrow that box when the option mark is focused. The version-diff fixture also waits for its final choice to reach the authoritative log and carries that choice into the next authored revision, satisfying the product's decision-preservation contract and removing the current-main CI failure seen on unrelated PRs.

Focused browser tests for the changed keyboard and conversation paths pass locally, and pre-commit passes on the changed file. Exact-head CI and review are running.

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

@max-sixty max-sixty left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one-key route is useful, but Enter cannot be reassigned while each .lf-pick still exposes role="button". The W3C ARIA button pattern requires both Space and Enter to activate a focused button: https://www.w3.org/WAI/ARIA/apg/patterns/button/

On this head, assistive technology announces the option mark as a button, but Enter performs the unrelated “write another option” action instead of mark.click(). The new tests then codify that semantic mismatch. Keep Enter activating the option and use a different shortcut or a separately exposed control for text entry, or change the focused element's role/structure so it no longer promises button behavior.

@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 findings, both verified by driving ASK_WITH_CONTEXT_PAGE under this head, and both separate from the role="button" question already on the thread.

1. Enter's destination drifts once the seat holds a thread. #words() reads the first textarea anywhere in the seat, and the seat's own first-message box is not always the first one there — or there at all. Detail and repro inline on lf-options.js.

2. Standing on a pick, the key line no longer names a key that answers the question. The Enter row is declared ahead of the digit row, and lineRows paints the first live row plus the available Escape, so the digits fall off. Measured on ASK_WITH_CONTEXT_PAGE after n, reading .lf-keyline once through key_line:

line on a focused pick
999f933 (base) 1–2 toggle the nth · esc let go
97c2d53 (this head) ⏎ write another option · esc let go

The digit chips still paint in the address column, so the addresses aren't unreachable — but the line's own two hints now both point away from picking. Declaring the Enter row after the digit row keeps 1–2 toggle the nth in the lead slot and costs the Enter row only the hint, not the binding; the new test asserts "write another option" in line, which would need to become an assertion about the reference or More instead. This holds whichever way the Enter/Space question above lands.

Two prose spots outside the diff that this contradicts — happy to push a commit for both if you want them
  • plugins/leaf/skills/leaf/CLAUDE.md, under Scope and dispatch: "A box with neither leaves the row dead and the page's own 'let go' standing … a seat holding no thread yet is that case whole, so it wears no seat of its own rather than being named as an exception. Asking whether the container can take focus is what keeps this a relation rather than a list of the containers that happen to be focusable." conversationReturns makes that seat answer after all, from a remembered route rather than from the climb, which is the thing that paragraph is written to rule out. Whatever the code settles on, that paragraph needs to say it.
  • plugins/leaf/skills/leaf/packages/default/theme.css, in the /* Warming the ring under the aim … */ comment: "the warmed tick and the wash are what say which mark ⏎ will take". After this change ⏎ does not take the mark.
Repro used for finding 1

Seeded on serve.page_dir before open_page, against ASK_WITH_CONTEXT_PAGE:

for text in ("First option I wrote.", "Second option I wrote."):
    root = events_model.append_event(serve.page_dir, {
        "kind": "comment", "author": "user", "version": 1,
        "anchor": {"section": "storage-options"}, "text": text,
    })
    events_model.append_event(serve.page_dir, {
        "kind": "reply", "author": "claude", "version": 1,
        "parent": root["id"], "text": "Understood.",
    })

The agent reply matters: with only the reader's comment standing, the group is off the reader's list (awaitsAgent) and n does not reach it at all, which is its own reason this state is easy to miss.

Then, focus on option 2's mark:

threads:          ['729ff678', '6297b954']
LINE:             '⏎\nwrite another option\nesc\nlet go\n?\nmore'
landed in thread: 729ff678

Escape from there lands on DIV.lf-conversation-thread, not on the mark.

With the seat's single thread resolved instead:

textareas in seat: 0
LINE:              '1–2\ntoggle the nth\nesc\nlet go\n?\nmore'
chosen after Enter: 1

Comment thread plugins/leaf/skills/leaf/assets/leaf.js Resolved

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

Both findings from the last review are answered, and answered at the right depth — #words() is scoped to the group's own seat with the height guard its sibling reading keeps, the digit row leads the key line again, and the two prose spots I flagged in the fold are rewritten. The route object also carries the caller's word, so landInConversation is reusable by a second widget without editing the kernel.

Three things this round, all statements the button → checkbox change leaves standing rather than anything the code gets wrong.

1. The registry description promises Enter in the exact state this PR added a test to rule out. Inline on registry.json — the same paragraph describes the re-arm and then says Enter reaches the box unconditionally.

2. Four comments still describe the pick mark as a role="button" press. theme.css, chrome-style.js, the skill CLAUDE.md's backFromBox paragraph and the registry all got rewritten for this; these didn't. One is in the diff (inline suggestion below); the other three are outside it:

  • plugins/leaf/skills/leaf/CLAUDE.md, under Scope and dispatch: "A control containing a page word is built by offer as a selectable span[role="button"]. The shared listener supplies Enter and Space semantics." The pick mark is the canonical control containing a page word — leaf.js's own header calls it "a control and a statement at once" — and after this change it is neither span[role="button"] nor served by the shared listener.
  • plugins/leaf/skills/leaf/assets/leaf.js, in the header block that ends "…offer builds every press as a span wearing role="button" for that reason, and wires the keys the UA would have given it." Not every press, and this one's keys are the widget's.
  • plugins/leaf/skills/leaf/assets/runtime/keyboard/bindings.js, the PRESS comment: "Five rows spelled it by hand — the runtime's own control scope, a card grip in each of its two states, an option's pick mark, and the version menu's row". The pick mark's row is now keys: [" "] and the file no longer imports PRESS; the census names a row that left.

Happy to push a commit for those three if you want them.

3. The widget hand-writes data-lf-offer, which offer says is the one marker a widget has no reason to touch. Inline on lf-options.js.

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

All three findings from the last round are answered, and the centralization is the right depth: offer("checkbox", …) produces byte-identical chrome to the three lines the widget was writing by hand, so the marker's value stays offer's to write and CONTROL_SELECTOR's [data-lf-offer="button"] still means exactly "the generic scope owns this press". The PRESS census is right at four (leaf.js's CONTROL scope, lf-board's two grip rows, version-navigation's menu row), and the two test docstrings that recite it were updated with it.

One statement this commit leaves standing, and one leftover.

1. CLAUDE.md still says offer supplies the press keys to every injected span control. Outside the diff — plugins/leaf/skills/leaf/CLAUDE.md, under Scope and dispatch, the paragraph after the Escape one:

offer supplies the two press keys for injected span controls at the shared bubble listener. A widget that already handled the event can prevent its default before that listener.

After this commit offer builds two kinds of injected span control and supplies the two press keys to one of them: a pick mark is data-lf-offer="checkbox", CONTROL's at asks [data-lf-offer="button"], and the Space that toggles it comes from lf-options' own row (keys: [" "]). This is the paragraph's twin, ~490 lines up under Anchors and marks, which you rewrote in this commit to say the split; the two now disagree inside one file. The "shared bubble listener" half is separately stale — widget-elements.js says of the pair "It was a listener of its own", the CONTROL scope having replaced it — so the sentence is worth taking whole rather than patching the count.

2. widget-elements.js line 180 is an un-reflowed leftover. // to touch. The stands alone at 18 characters mid-paragraph, where the rest of the block runs 80–92. bindings.js 134–136 is the milder version of the same edit (the paragraph now breaks after "…Space too. A" at 69). Neither is prettier's — it doesn't reflow comments — so nothing else will catch them.

Happy to push a commit for both if you want them.

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

One finding, and it comes from the base this branch merged rather than from anything the branch itself changed: main gave lf-options a version-response conversation (x-conversation.response = {kind: version, verb: choose}), and test_enter_does_not_drift_into_an_existing_option_thread still describes the pre-merge re-arm. Detail inline.

The conflict resolution in the lf-options description reads correctly to me — it keeps main's new re-arm prose (leaf reply refuses, clarification goes through leaf comment --section) and folds in this PR's conditional Enter sentence rather than the unconditional one an earlier round flagged. Both merge commits produce the same tree, so there is one resolution to read, not two.

test is still running on a30bea9; I stopped polling at the cap, so it is unverified rather than green.

Comment thread tests/test_render_options.py Resolved

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

Both touched tests pass at this head, and the rewritten drift fixture still bites: unscoping SAY_BOX in leaf.js back to .lf-say textarea fails test_enter_does_not_drift_into_a_clarification_thread on Locator expected to be focused, so swapping the option-thread state for the version-response one kept the coverage rather than trading it away. tests/test_render_options.py is 53/53 green here.

Two things about the pair of commits that landed on test_a_pick_offered_can_be_pointed_at_too, which is a different test from this PR's subject.

1. round_trip(page) is the same one-line fix as open PR #71, and the two collide. #71 (fix/ci-33038969372) is the ci-fix for this exact main-red test, and its hunk context is page.keyboard.press("Enter") on the line directly above the insertion — which this PR rewrites to press(" ") for the checkbox change, so whichever of the two lands second needs a hand resolution. One of them should go. #71 also carries a five-line comment for why the trip is there, which is the half worth keeping either way — inline suggestion below.

2. 1e39cb8 is not what turns the test green, and it costs the assertion under it its subject. Detail inline on the chosen move.

Measurements

At 72c7abd, -n0, tests/test_render_options.py -k pointed_at_too:

tree result
as pushed 4/4 pass
1e39cb8's fixture hunk reverted (stamp_version_file + plain reword), round_trip kept 4/4 pass
1e39cb8 kept, round_trip(page) removed 4/4 fail — refusing to stamp index.html: <lf-option id='opt-strict'> (line 17): its words changed, and the user has already acted on it (choose on r1)

The race #71 describes is visible without the trip: at bb41d89 the refusal named <lf-options id='transport'> on one run and <lf-option id='opt-strict'> on three others, which is the standing decision landing on the group or on a card depending on how many presses reached the log.

Bug-back for the drift test: with const SAY_BOX = ".lf-compose textarea, .lf-say textarea" (the :scope > dropped), #words() finds the clarification's box, Enter lands in it, and the test fails on the mark no longer being focused.

test on ci is still running at this head; I read the options file locally rather than waiting on it, so the rest of the suite is unverified here.

Comment thread tests/test_render_options.py Resolved
Comment thread tests/test_render_options.py Resolved
@max-sixty
max-sixty merged commit fb28c76 into main Aug 27, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/ask-keyboard branch August 27, 2026 05:47
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