Repository navigation
Read an empty text field as the same editable textbox before its editor builds - #3307
Merged
Merged
Conversation
…or builds An empty `leaf-text` builds its CodeMirror editor only when the user arrives in it (#3304), and the box drawn in its place stood in for the editor's content node to assistive technology. It was a textbox with the right name, hint and description, but not an editable one: Chromium's tree left out `editable`, which screen readers use to say "editable", its value was empty where the editor's empty line holds a line break, and a read-only field lost `aria-readonly` until it built. The box now declares what CodeMirror's content node is: a multiline textbox, `contenteditable="plaintext-only"` (CodeMirror's theme makes its own node plain-text only), `aria-readonly` while the field is read-only, and the same spelling, name and placeholder attributes, with a line break in its empty line. Being editable it is a tab stop by itself, so it drops its `tabindex`. Each named node the field gives the accessibility tree now reads the same before and after the editor builds, compared in Chromium through CDP and in Firefox through its own accessibility service: - Chromium: the content textbox's role, name, description, value and properties (`editable: plaintext`, `focusable`, `multiline`) match; before this change `editable` was missing and the value was empty. - Firefox: role `entry`, name, description, value and states (`editable`, `focusable`, `multi line`, and `readonly` for a read-only field) match; before, the value was empty and `readonly` was missing. What still differs is structure inside the editor that names nothing: CodeMirror's wrappers and its empty polite live region, which give the host one more child once the editor is built. Neither was checked in a real screen reader. A new browser test tabs onto an empty field, types a key that lands, deletes it, and compares the field's named nodes in Chromium's tree with those it read before the editor existed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 20, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 19, 2026
…tarea from #6383 (#6453) #6383 stands the floating panel's row from the first paint and makes an unbuilt text field's box a textarea. Three main-tier tests still asserted the earlier behavior, and each one failed on `main`. This PR updates the tests to match #6383 and changes no product code. Each test fails on `main` (`c865c3e99`) and passes on this branch, run with `uv run pytest <node id> -n 0`. - **`test_startup_continues_while_the_registry_fetch_is_held`** asserted that no panel stands while the registry fetch is held. Now the panel there is the row the document served (`data-lf-served`), which #6383 meant to show. The test asserts that instead, so it still checks that the runtime's panel hasn't mounted. - **`test_an_empty_field_reads_the_same_before_and_after_its_editor_builds`** compared the accessibility nodes exactly. An empty textarea gives the tree no value, while CodeMirror's empty line reads `'\n'`, and a textarea reports `invalid: false`. Those two differences are the whole failure. The textarea still matches the editor on role, name, description, `editable`, `focusable`, `multiline`, `readonly` and `required`, which are what #3307 made the test check. The test now holds the field's editable node to its exact empty value: Chromium's tree gives the empty textarea no value at all, and the built editor's empty document one line break (`'\n'`), so a field holding several blank lines no longer passes. It ignores `invalid: false` and still compares every other node and property before and after. No screen reader was run; the docstring describes the observed tree. - **`test_firefox_s_copy_of_a_group_builds_no_add_field`** no longer reached the case it guards. In both commits, Firefox's selection at mouseup sits in the add field's shadow root, at the placeholder text. Before #6383, `cloneContents()` on it threw `HierarchyRequestError`. With the textarea, it clones without error. I tried the same drag on this commit after the field's editor had built (an editable node is back in the shadow root), and it throws again. So the `inWindowDocument` guard in `widget-upgrade.js` and `leaf-element.js` is still needed. The test now focuses the field and releases focus before the drag, which brings the guarded case back. Closes #6451 — automated triage --------- 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.
An empty
leaf-textbuilds its CodeMirror editor only when the user arrives in it (#3304), and the box drawn in its place stood in for the editor's content node to assistive technology. It was a textbox with the right name, hint and description, but not an editable one: Chromium's tree left outeditable, which screen readers use to say "editable", its value was empty where the editor's empty line holds a line break, and a read-only field lostaria-readonlyuntil it built.The box now declares what CodeMirror's content node is: a multiline textbox,
contenteditable="plaintext-only"(CodeMirror's theme makes its own node plain-text only),aria-readonlywhile the field is read-only, and the same spelling, name and placeholder attributes, with a line break in its empty line. Being editable it is a tab stop by itself, so it drops itstabindex.Each named node the field gives the accessibility tree now reads the same before and after the editor builds:
Accessibility.getFullAXTreeeditablemissing, value emptyeditable: plaintext,focusable,multiline) matchreadonlymissing on a read-only fieldentry, name, description, value and states (editable,focusable,multi line,readonly) matchWhat still differs is structure inside the editor that names nothing: CodeMirror's wrappers and its empty polite live region, which give the host one more child once the editor is built. Neither version was checked in a real screen reader such as VoiceOver.
Arrival is unchanged against the base in Chromium, Firefox and WebKit: Tab, click, right-click and the field's own
focus()each give the page onefocusand onefocusinon the field, the sameselectionchangecount, and land the next typed key in the field.A new browser test in
tests/browser/controls/test_focus.pytabs onto an empty field, types a key that lands, deletes it, and compares the field's named nodes in Chromium's tree with those it read before the editor existed. It fails on the base.