![]()
Accessibility Connections
- For accessibility in online learning and education, join the UDAT working group.
- Attend one of the Digital Accessibility Liaisons' monthly trainings.
- Connect with us on ASU's #accessibility Slack channel.
Everyone benefits from well-organized, easy-to-use forms. But it is especially essential for people who use screen readers and screen magnification andwho navigate websites using a keyboard. Without carefully planned and marked up forms, many of these users cannot access online forms.
Every form input must be associated with a label. There are two ways to associate labels with form inputs:
The first is to provide matching FOR and ID values for each label-input pair:
<label for="name">Name</label><input id="name" type="text" name="name">
The second is to wrap both the label text and the input in <label>...</label> tags:
<label>Name <input type="text" name="name"></label>
Here's a textarea example:
<label for="message">Your Message:</label><textarea id="message" name="message"></textarea>
<label>Your Message: <textarea name="message"></textarea>
Here's a radio button example:
<label for="subscribe">Subscribe?</label><input type="radio" id="subscribe" name="subscribe" value="subscribe">
<label>Subscribe? <input type="radio" name="subscribe" value="subscribe"></label>
Although not recommended, if you must hide a label due to design considerations, use a CSS method to visually hide the label, while retaining the markup for screen readers.
Example:
HTML:<label for="search" class="visually-hidden">Search</label><input id="search" type="text" name="search">CSS:.visually-hidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;}
Alternately, form controls without labels can be identified by an ARIA-LABEL attribute. (See more on WAI-ARIA.)
Example:
<input id="search" type="text" name="search" placeholder="Search" aria-label="Search">
NOTE: Screen readers do not read placeholder text, so it should never be a replacement for a label.
Fieldsets wrap related form controls together. Legends describe the group and should be brief because screen readers repeat them for every field control.
Example with radio buttons:
<fieldset><legend>Choose a meal choice:</legend><input id="chicken" type="radio" name="chicken-dinner" value="chicken"><label for="chicken">Chicken</label><br><input id="fish" type="radio" name="fish-dinner" value="fish"><label for="fish">Fish</label><br></fieldset>
Example with text fields:
<fieldset><legend>Your address:</legend><label for="street">Street</label><input id="street" type="text" name="street"><label for="zip">Zip Code</label><input id="zip" type="text" name="zip-code"></fieldset>
Single checkboxes and simple pairs of radio buttons (Yes/No) do not need fieldsets and legends.
Consider using <optgroup> to visually break up long lists of select options to make them more manageable. Optgroups provide non-selectable labels.
Example:
<label for="toppings">Select pizza toppings:</label><select id="toppings" name="pizza-toppings"> <optgroup label="Meat"> <option value="1">Pepperoni</option> <option value="2">Sausage</option> <option value="3">Bacon</option> <option value="4">Ham</option> </optgroup> <optgroup label="Vegetable"> <option value="5">Onions</option> <option value="6">Green pepper</option> <option value="7">Mushroom</option> <option value="8">Olives</option> </optgroup></select>
If an image is used for a submit button, ensure that an equivalent text alternative is provided in the markup. Don't use Reset buttons because they are often accidentally clicked.
Example:
<input type="image" name="submitbutton" alt="Submit" src="submit.png">
If a field is required, a clear indication of this should be included inside the label or by using an ARIA state. (See more on WAI-ARIA.)
Examples:
<label for="username">Username <span class="red">(required)</span></label><input id="username" type="text" name="username"><label for="username">Username</label><input id="username" type="text" name="username" aria-required="false">
Error messages must be informative, apparent and accessible. The primary ways to meet this requirement are:
See more on live regions and error messages in the WAI-ARIA guidelines.
Screen readers usually skip over any text in forms that is not inside a form element. Therefore, include help tips and instructions either at the beginning of the form, inside the form control's label, or in an aria-describedby attribute. (See more on WAI-ARIA.)
Example:
<label for="password">Create a password:</label><span id="pass-tip">Passwords must be 8-12 characters and can include letters, numbersand symbols.</span><input id="password" type="password" name="new-password" aria-describedby="pass-tip"><br>
Many users navigate forms using the keyboard. Check that a form is keyboard accessible by ensuring that:
![]()