Dieser Inhalt ist derzeit nur auf Englisch verfügbar
Audit aria-input-field-name
Ensure every ARIA input field has an accessible name
Impact:
Serious
WCAG-Konformität:
A
WCAG 4.1.2
Issue types:
failure, needs review
Form field has non-empty accessible name
This rule checks that each form field element has a non-empty accessible name.
Content loading...
Autoren: Anne Thyme Nørregaard, Bryn Anderson
Finanzierung: WAI-Tools
Applicability
This rule applies to any element that is included in the accessibility tree, and that has one of the following semantic roles: checkbox, combobox (select elements), listbox, menuitemcheckbox, menuitemradio, radio, searchbox, slider, spinbutton, switch, textbox.
Expectation
Each target element has an accessible name that is not empty ("").
Background
The list of roles in the applicability is derived by taking all the roles from WAI-ARIA Specifications that:
have semantic roles that inherit from the input, menuitem or select role; and
are form field controls (this notably excludes menu, option or tree).
This rule does not test other control-like roles such as button and menuitem, because these do not inherit from input or select. These should be tested separately.
Several assistive technologies have a functionality to list all form fields on a page, including the disabled ones. Therefore this rule is still applicable to disabled form fields. If an assistive technology consistently ignores disabled form fields in all its interactions, then it is possible to have a disabled form field with no accessible name without creating accessibility issues for the user.
Implementation of Presentational Roles Conflict Resolution varies from one browser or assistive technology to another. Depending on this, some elements can have one of the applicable semantic roles and fail this rule with some technology but users of other technologies would not experience any accessibility issue.
This input element has an accessible name because of its placeholder attribute.
Note: While the placeholder attribute is sufficient to provide an accessible name, a visiblelabel that does not disappear when a user starts to enter data is still required for success criterion 3.3.2 Labels or Instructions.
This semanticcheckbox element has the text content as its accessible name.
<divrole="checkbox">I agree to the terms and conditions.</div>
Passed Example 8
These menuitemcheckbox elements have an accessible name because its aria-labelledby attribute references a span element.
<pid="dip">Add one or more dip:</p><divrole="menu"aria-labelledby="dip"><inputtype="checkbox"role="menuitemcheckbox"aria-labelledby="ketchup" /><spanid="ketchup"aria-hidden="true"
>Ketchup</span
><br /><inputtype="checkbox"role="menuitemcheckbox"aria-labelledby="mayonnaise" /><spanid="mayonnaise"aria-hidden="true"
>Mayonnaise</span
>
</div>
Failed
Failed Example 1
This input element does not have an attribute that gives an accessible name to it.
<div>last name</div><input />
Failed Example 2
This disabled input element does not have an attribute that gives an accessible name to it.
<inputdisabled />
Failed Example 3
This input element has an empty ("") accessible name because the space in the aria-labelattribute value is trimmed.
<inputaria-label=" " />
Failed Example 4
This select element has an empty ("") accessible name because the div has no text content.
This semantictextbox element has an empty ("") accessible name. The parent label element does not give it an accessible name, this only works for native form fields.
<label>
first name
<divrole="textbox"></div></label>
Failed Example 6
This semantictextbox element has an empty ("") accessible name. The label element does not give it an accessible name, this only works for native form fields.
This semantictextbox element has an empty ("") accessible name. The text content of the element serves as its value, not as an accessible name.
<divrole="textbox">first name</div>
Failed Example 8
These menuitemcheckbox elements do not have an accessible name.
<pid="dip">Add one or more dip:</p><divrole="menu"aria-labelledby="dip"><inputtype="checkbox"role="menuitemcheckbox" /><spanaria-hidden="true">Ketchup</span><br /><inputtype="checkbox"role="menuitemcheckbox" /><spanaria-hidden="true">Mayonnaise</span></div>
Inapplicable
Inapplicable Example 1
This input element is not included in the accessibility tree because of its style attribute which sets display to none.