Skip to content

compiler: warn about an accessible text input inside another one - #13361

Open
tronical wants to merge 2 commits into
masterfrom
simon/textinput-nest-diagnostic
Open

tronical wants to merge 2 commits into
masterfrom
simon/textinput-nest-diagnostic

Conversation

@tronical

Copy link
Copy Markdown
Member

An element with a text input role describes the text of the TextInput below
it, and an accessible text input in between describes the same text again.
accesskit_consumer aborts the process over a child that two items claim, so a
UI built that way closes as soon as a screen reader attaches. Three places in
this repository were built that way, none of them noticed until a user ran
into it.

The check walks the tree the way the runtime does: a role set where a
component is used counts together with the elements inside that component, an
element and the root of the component it instantiates are one item, and a
popup starts a tree of its own. The role an element ends up with is the one
its most derived binding names, since setting the role where a component is
used writes it to the root element of that component, which is what makes
'accessible-role: none' the fix to point at in every case.

The time picker inputs, in the widgets and in the material library, the
usecases demo's line edit, and the visual editor's inspector field left their
TextInput the accessible role it gets by default, while the element around it
carries a text input role too. Both then describe the same text, which
accesskit_consumer refuses: it aborts over a child that two items claim, so a
screen reader attaching to one of these closed the program.

The inner input now stays out of the description, the way lineedit-base and
the other widget bases already do it, and the element around it describes the
field with its own label and value.
An element with a text input role describes the text of the TextInput below
it, and an accessible text input in between describes the same text again.
accesskit_consumer aborts the process over a child that two items claim, so a
UI built that way closes as soon as a screen reader attaches. Four places in
this repository were built that way, none of them noticed until a user ran
into it.

The check walks the tree the way the runtime does: a role set where a
component is used counts together with the elements inside that component, an
element and the root of the component it instantiates are one item, and a
popup starts a tree of its own. The role an element ends up with is the one
its most derived binding names, since setting the role where a component is
used writes it to the root element of that component, which is what makes
'accessible-role: none' the fix to point at in every case.
@tronical
tronical force-pushed the simon/textinput-nest-diagnostic branch from 688f85b to 51a981d Compare September 11, 2026 20:08
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.

1 participant