Lesson 9 of 9
Form Accessibility & Best Practices
Accessible forms ensure that all users - including those using screen readers, keyboard-only navigation, or voice control - can successfully fill out and submit forms. Proper form accessibility involves labels, error messages, focus management, ARIA attributes, and logical tab order.
Form Accessibility Checklist
- Every input MUST have a visible <label> - Never rely on placeholder text alone. Placeholders disappear when typing.
- Use aria-describedby for help text - Connect helper text to its input: <input aria-describedby='pwd-help'> <span id='pwd-help'>Min 8 characters</span>
- Use aria-required='true' alongside required - Some older screen readers don't announce the HTML5 required attribute.
- Error messages must be announced - Use aria-live='polite' on error message containers so screen readers announce errors when they appear.
- Use aria-invalid='true' on invalid fields - Tells screen readers the field has an error.
- Logical tab order - Ensure Tab moves through fields in a natural reading order. Never use tabindex > 0.
- Don't disable the submit button - Instead, show validation errors. Disabled buttons confuse users who don't understand why they can't submit.
- Group related fields with <fieldset> - Screen readers announce the <legend> when entering the group, providing context.
- Use autocomplete attributes - Assists all users and is especially helpful for users with motor disabilities.
- Test with keyboard only - Can you fill and submit the form using only Tab, Enter, and Space? If not, it's not accessible.
Diagram
Loading diagram…
Accessible error messages ensure all users can successfully complete forms
Quick Quiz: Form Accessibility
Module 6 - Knowledge Check
Module 6 - Knowledge Check
Question 1 of 5Which input type shows a native date picker and requires NO JavaScript?
Practice Task: Complete Registration Form
- Build a registration form with text, email, password, tel, date, and file inputs — each with a proper <label> using for/id
- Add HTML5 validation: required on mandatory fields, pattern for password strength, minlength/maxlength on text fields
- Group related fields (personal info, preferences) using <fieldset> and <legend>
- Add a <datalist> for auto-complete suggestions on one text field
- Style the form with CSS :valid/:invalid pseudo-classes to show green/red borders on validated inputs
Key Takeaways
- Accessible forms ensure that all users - including those using screen readers, keyboard-only navigation, or voice control - can successfully fill out and submit forms.
- Every input MUST have a visible <label> - Never rely on placeholder text alone. Placeholders disappear when typing.
- Use aria-describedby for help text - Connect helper text to its input: <input aria-describedby='pwd-help'> <span id='pwd-help'>Min 8 characters</span>
- Use aria-required='true' alongside required - Some older screen readers don't announce the HTML5 required attribute.
Finished this lesson?
0 of 9 in Module 6