Indicate required fields for screen readers
Screen readers announce form fields as required if they have the HTML attributes aria-required="true" or required on the form field.
Basic HTML examples
Using aria-required=”true”
<label for="name">Your name (required)</label>
<input
id="name"
type="text"
name="name"
autocomplete="name"
aria-required="true"
aria-invalid="false"
/>
Using required
<label for="name">Your name (required)</label>
<input
id="name"
type="text"
name="name"
autocomplete="name"
required
aria-invalid="false"
/>
The attribute required triggers the client-side form validation of the browser.
Client side validation may create accessibility and usability issues. The topic about feedback on form errors will address this in more detail.
If you decide to use required, also use novalidate on the form element to prevent the browser’s form validation from kicking in and enable you to handle validation server-side.
<form action="some-url" novalidate>
Note: The use of aria-invalid is addressed in Provide feedback to screen reader users on form errors.
Resources
WCAG Success Criteria for required fields.
By indicating required fields, you meet WCAG success criterion 3.3.2 Labels or Instructions (Level A).
Related pages in this documentation
- Option 1: Marking only the required form fields in Standards and best practice, Web forms.
- Option 2: Marking only the optional form fields in Standards and best practice, Web forms.
- Provide feedback to screen reader users on form errors in Standards and best practice, Web forms.
Using aria-required or required in WordPress plugins
Gravity Forms adds aria-required="true" to required fields.
Help wanted: We’d like to invite people familiar with form plugins to help us add instructions for WordPress form plugins. Like possibilities, settings and screenshots. Please contact us if you want to help us with this additional content.
Other resources
- aria-required on MDN.
- HTML attribute: required on MDN.
- Validating Input by the W3C.
- Guidelines for web forms (Dutch content) by the NL Design System.
WP Accessibility Knowledge Base