How to test
The How to test snippet is in production
Making forms accessible is a simple process. Each form element should be associated with its instructions and errors, and everything should be accessible via the keyboard.
Testing
- Identify each form element.
- Find all instructions associated with each element.
- It is a failure if a form element isn’t programatically associated with all instructions. This includes legends, labels, hint text and tooltips.
- A common way of achieving this is using
fieldsetandlegendtags.Fieldsetis used to group a set of elements.Legendis the first child of afieldsettag and provides context for those fields.
- Ensure all field elements are accessible via the keyboard.
- If the form cannot be filled out with just a keyboard, this is a failure.
- Check for title attributes
- Title attributes can be a substitute for labels.
- If the title attributes provides all the related information it passes, if it provides extra information it fails.
- Title attributes are not accessible via keyboard.