Accessible Forms & Labels: Error Handling, Hints & Autocomplete
Eliminate form friction with explicit <label> associations, non-disappearing instructions, and accessible inline validation.
Key Takeaways
- Never replace <label> with placeholder text.
- Connect field hints and errors using aria-describedby and aria-invalid='true'.
- Add HTML autocomplete attributes for personal info fields (WCAG 1.3.5).
Wiring Labels, Hints & Errors
When validation fails, show specific corrective text beside the field, mark aria-invalid='true', and announce summary feedback politely or move focus to an error summary.
Complete Accessible Input
<label for="email">Work email</label>
<input id="email" type="email" autocomplete="email" aria-describedby="email-err" aria-invalid="true">
<p id="email-err" role="alert">Enter a valid email like name@company.com.</p>Frequently Asked Questions
Interactive Tools for This Guide
Form Accessibility Checker
Inspect HTML forms for label bindings, button names, and duplicate ID conflicts.
Label Association Checker
Verify <label for> bindings, wrapping labels, and orphaned form controls.
Accessible Form Generator
Generate semantic forms with labels, hint wiring, error alerts, and autocomplete.
Continue Reading
Accessible Semantic HTML: Building on Native Elements
Semantic HTML gives you roles, states, and keyboard behaviors for free. Learn how to avoid div-soup anti-patterns.
Mobile Form Accessibility: Labels, Inputmode & Autocomplete
Reduce mobile form friction with smart virtual keyboards, autofill, and clear error recovery.