Some HTML bits and what they sound like to a screen reader. Some big things to remember are:
- every form control needs a name (visible or not);
- every group of controls needs a name (visible or not);
- generally prefer (correctly marked-up) visible names as they work for all users;
- when we donβt use the right HTML, things can be invisible or opaque to screen reader users.
Here are a bunch of tiny samples:
Single inputs
-
Input wrapped in label sounds like
Username, edit text.
-
No for and id attributes on the label and input sounds like
Edit text.
-
With for and id attributes on the label and input sounds like
Username, edit text.
(best choice) -
With just an input and an aria-label sounds like
Username, edit text.
Grouped inputs, radios
-
Radios without fieldset or legend sounds like
Once-off, radio button
-
Radios without legend sounds like
Once-off, radio button
-
Radios with fieldset and legend sounds like
Frequency grouping, Once-off, radio button, not checked, 1 of 2
(best choice) -
Radios without a visible group name sounds like
Frequency grouping, Once-off, radio button, not checked, 1 of 2
-
Radios without a visible radio button sounds like
Frequency grouping, Once-off, radio button, not checked, 1 of 2
Grouped inputs
-
Four part date control with visible names sounds like
Event date group, Day, 1, combo box
(best choice) -
Four part date control without visible names sounds like
Event date group, Day, 1, combo box
-
From and to dates, in three parts sounds like
Event date group, From day, 1, combo box
-
Radios with sentence style contents and form controls in them sounds like
Recurring options group, Repeat frequency, radio button, not checked. [tab] Recurring options group, Number, 1, combo box.
Inputs and errors
-
Input with HTML5 required sounds like
Username, edit text, required, invalid entry
-
Input with aria-required sounds like
Username, edit text, required
-
Input with aria-required, error-state error message not linked sounds like
Username, edit text, required.
-
Input with aria-required and aria-describedby error message, initial state sounds like
Username, edit text, required.
(best choice) -
Input with aria-required, aria-invalid, and aria-describedby error message sounds like
Username, edit text, required, invalid entry. Please enter a value.
(best choice)
Described By
-
Button with some text nearby sounds like
Add, Button
-
Button with some extra text in it sounds like
Add 10 items, Button.
-
Button with aria-describedby sounds like
Add, Button. 10 items selected.
(best choice)
Accessible names
-
Button with text in it sounds like
Add a question, Button
-
Button with text and screen reader text in it sounds like
Add a question, Button
-
Button with text and an icon in it sounds like
Add, Button
-
Button with just an icon in it sounds like
Add, Button
-
Button with just an icon in it, aria-labelledby sounds like
Add a question, Button