| title | Forms Accessibility Best Practices |
|---|
This document defines project-level requirements for accessible form design, validation, and error handling.
All users must be able to understand, complete, and submit forms with assistive technologies, keyboard-only input, and varying cognitive needs.
- Every form control must have a programmatically associated label.
- Placeholder text must not be used as the only label.
- Required fields must be identified in text, not by color alone.
- Provide concise instructions before complex input groups.
- Use
fieldsetandlegendfor related controls (for example, radio groups). - Keep visual and semantic grouping aligned.
- Use headings to separate long forms into clear sections.
- Use appropriate input types (
email,tel,number,date) where valid. - Add
autocompletevalues for common user data when appropriate. - Avoid input patterns that block paste or standard keyboard actions.
- Validate on submit at minimum; avoid disruptive real-time validation.
- Error messages must be specific and actionable.
- Error text must be programmatically associated with the invalid field.
- Mark invalid controls with
aria-invalid="true"when applicable. - Do not rely on color alone to indicate errors.
For multi-error submissions:
- Show an error summary near the top of the form.
- Move focus to the error summary after failed submit.
- Each summary item should link to the corresponding field.
- Announce submission status and async validation outcomes to assistive tech.
- Use polite live regions for non-critical updates.
- Use assertive announcements only for blocking failures.
- Warn users before timeout when possible.
- Provide a way to extend session time for critical workflows.
- Preserve entered data when safe and feasible.
Minimum checks for each form change:
- Navigate and complete the form using keyboard only.
- Verify screen reader announces labels, required state, and errors correctly.
- Submit with invalid inputs and confirm clear recovery paths.
- Confirm focus moves to error summary and then to each field link target.
A form change is complete only when:
- All controls have accessible names.
- Validation and error recovery are understandable and navigable.
- Keyboard and screen reader workflows pass manual checks.
- No blocking accessibility defects remain.
For AI systems and automated tooling, see wai-yaml-ld for structured accessibility standards:
- WCAG 2.2 (YAML) - Machine-readable WCAG 2.2 normative content including form-related success criteria
- ARIA Informative (YAML) - ARIA-focused informative catalog including form roles and properties
- HTML Living Standard Accessibility (YAML) - HTML form element accessibility
- Standards Link Graph (YAML) - Relationships across WCAG/ARIA/HTML form standards