Lesson 6 of 9 · 24m
Forms, Errors, and Live Regions That People Can Use
Labeling controls, grouping related fields, announcing validation without noise, and designing dynamic updates that do not ambush assistive technology.
Forms are where accessibility defects become business defects. A missing label is not abstract; it is a user who cannot complete checkout. A noisy live region is not theoretical; it is a screen reader shouting over every keystroke until the user gives up.
Labels are not optional decoration
<label for="team-name">Team name</label>
<input id="team-name" name="teamName" autocomplete="organization">
<fieldset>
<legend>Billing interval</legend>
<label><input type="radio" name="interval" value="monthly"> Monthly</label>
<label><input type="radio" name="interval" value="annual"> Annual</label>
</fieldset>Placeholder text is not a label. It disappears when typed, often has poor contrast, and does not reliably expose a persistent accessible name. fieldset and legend explain how grouped controls relate; without them, radio groups become a pile of isolated choices.
Tie errors to fields
<label for="password">Password</label>
<input id="password" type="password" aria-invalid="true" aria-describedby="password-error">
<p id="password-error">Use at least 12 characters.</p>Three things matter: the field is marked invalid, the message is programmatically associated, and the data is preserved. Do not clear the form on failure. Move focus to a summary or the first invalid field when the error is the result of submission, but avoid yanking focus while the user is still typing.
Live regions are for announcements, not narration
<div role="status" aria-live="polite">3 results found</div>Use a status region when a change matters but should not interrupt. Use role="alert" sparingly for urgent messages. Every keystroke in a search field does not need to be announced; announce the settled result count, not the entire re-render. Also remember that many live-region implementations only announce text changes, so injecting identical text repeatedly may produce silence.
Validate at humane moments
Validate on blur for individual fields and on submit for the complete form. Clear errors as soon as the input satisfies the rule. Do not use color alone to communicate failure; provide text and programmatic state.
Field notes
- Required fields need a programmatic indicator such as
requiredoraria-required, not just a red asterisk. autocompletevalues are accessibility features: they reduce cognitive and motor load.- CAPTCHAs are an accessibility boundary; provide an accessible alternative path or a provider with one.
- Toast-only errors vanish before many users can find them. Persistent inline errors win.
Was this lesson helpful?