Definition for WCAG 2.1 success criterion 2.4.12
2.4.12 Label in Name: For user interface components with labels that include text or images of text, the name contains the text presented visually.
Note: A best practice is to have the text of the label at the start of the name.
The intent of this success criterion is to ensure text-to-speech users will have a better experience because the labels that they hear match the visible text labels that they see on the screen.
Form controls often have visible text labels. Form controls also have an accessible name although the computed accessible name may not match the visual label for the form control. Some users, such as speech input users, have a much better experience if visible text labels match the accessible names.
Speech input users can navigate webpages by speaking the visible text labels of menus, links and button labels that appear on a webpage. It’s confusing to speech input users when they say a visible text label visible on the page, but the command does not work because the computed accessible name does not match the visible label.
This issue is even more important for Speech input and text-to-speech users who also have cognitive challenges. Remembering a speech command that does not match a visible label increases cognitive load. Parsing text output that does not match the visible label also increases cognitive load.
Note: If an icon has no accompanying text, its visible label is its hover text.
Testing success criterion 2.4.12
Input into spreadsheet
- Fail
- The accessible name does not match the visible label, and the accessible name does not start with the visible label.
- Pass
- The accessible name matches the visible label, or the accessible name starts with the visible label.
- N/A
- The sample has no interface elements.
How to test
-
For each label for user interface elements:
- Ensure the accessible name matches the visible label, OR
- Ensure the accessible name starts with the visible label.