Skip to content

Make a text field's host a group, so a screen reader hears an empty field as empty - #7267

Merged
max-sixty merged 2 commits into
mainfrom
agent-a933ae0cef8c71b55
Nov 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a933ae0cef8c71b55

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A leaf-text host now takes role="group", and the node inside is the field's one textbox. Chromium reads a textbox that isn't a native input by its slotted text, aria-hidden included, so a screen reader heard the panel's empty reply box as a textbox holding "Resolved “…” Next thread t", with the Next thread button inside it and a second, empty textbox inside that. Every rich hint did too: an idle margin Reply held "Reply… ⏎ · New line ⇧⏎". Now it hears a group holding the press as a button beside one empty textbox. leaf-dev stills --base shows no change in Chromium, Firefox or WebKit.

ARIA allows aria-multiline only on a textbox, so the one-line declaration becomes Leaf's boolean one-line, and every reader, module-input.md included, moves to it.

To weigh: Playwright can't see into the closed root, so tests that found a field by role textbox now call text_field(scope, name), which finds the leaf-text group by the same name and exactness. 82 locators changed mechanically; 51 finding a page's own inputs stay.

Tests: focused browser tests (press, Undo, Next On Me, one-line options, rewritten locators); pnpm run test:runtime.

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

…ield as empty

A `leaf-text` host took `role="textbox"` so Playwright and axe, which can't see into
its closed root, would find the field. Chromium reads a textbox that isn't a native
input by its light-DOM text, `aria-hidden` included, and parents what is slotted into
it under the textbox. Read from Chromium's accessibility tree before this change:

- the panel's thread reply box after a Resolve: a textbox valued
  `Resolved “…”\nNext thread\nt`, holding the button "Next thread t" and a second,
  empty textbox, the content node focus lands in;
- the panel's page box: a textbox valued `Away\nNext On Me\nm`, holding "Next On Me m";
- a margin card's Reply, with no press: a textbox valued `Reply…\n⏎\n· New line\n⇧⏎`.

#5613 hid the placeholder's words with `aria-hidden`, which kept them out of the tree
as nodes but not out of the host's value. The host now takes `role="group"`: each
field reads as a group named for the box, holding its press as a button beside one
empty textbox whose placeholder carries the words. `leaf-dev stills --base` shows no
change in Chromium, Firefox or WebKit.

ARIA allows `aria-multiline` only on a textbox, so the one-line declaration on the
host is renamed to Leaf's boolean attribute `one-line` (the name the code and prose
already gave the concept, as HTML calls a text input "a one line plain text edit
control"). text-field.js, input.js, response.css, lf-options-addition.js and
module-input.md move to it; the content node still states `aria-multiline` itself.
The file editor's `aria-multiline` stays: it is on that editor's own CodeMirror
textbox.

Tests: Playwright's role engine can't see the textbox inside the closed root, so the
82 `get_by_role("textbox", …)` locators that found a Leaf field now call
`text_field(scope, …)` (leaf_dev.browser), the `leaf-text` group by the same name and
exactness; the 51 that find a page's own input, textarea or editor are unchanged.
#5613's Resolve test now reads the field's accessibility tree and requires exactly one
textbox, empty and holding no button, beside the press; `accessible_tree` replaces
`accessible_node`, which it alone used. The options tests read `one-line` where they
read `aria-multiline="false"`.
leaf-agent
leaf-agent previously approved these changes Nov 26, 2026
@max-sixty
max-sixty merged commit 7836b38 into main Nov 26, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a933ae0cef8c71b55 branch November 26, 2026 10:45
leaf-agent added a commit that referenced this pull request Nov 26, 2026
…ince #7267 made its host a group (#7277)

`test_on_me_claims_nothing_before_the_first_replay` failed on main ([run
45808911571](https://github.com/max-sixty/leaf/actions/runs/45808911571),
`dcf5eb41c`). It asserted `to_be_editable()` on the `leaf-text` host,
and #7267 made that host `role="group"` so a screen reader hears one
inner textbox. Playwright refuses that assertion on a group ("Element is
not an <input>, <textarea>, <select> or [contenteditable]…"). The test
now types a character into the page's comment field while the first
state answer is still held, checks the field holds it, and deletes it.
The behavior it protects is the same: the field takes words before the
log has answered. #7267's change stays as it is.

Verification: the test fails on main with the error above and passes on
this branch (Chromium, locally).

The same run's other failures already have owners:
`test_a_stuck_sidebar_track_keeps_its_place_to_the_page_end` is waiting
on the maintainer in #7245, and #7274 fixed
`test_a_thread_on_words_a_widget_renders_stands_where_the_widget_does`
after this run's commit.

Refs #7276 — automated triage

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