-
-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Describe the bug
When a field has a validation error, Formie renders the <input> with aria-invalid, which is correct. It also displays an error message below the input and adds/updates the aria-describedby attribute of the <input> to point to the error message.
There are two problems with this:
- The correct attribute to indicate the error message for an invalid input is
aria-errormessage(MDN). Using this attribute allows screen readers to announce the message as an error, not as a generic description. - If the field also has regular instructions,
aria-describedbyis already used to relate the<input>to those instructions. Once the form is submitted, thearia-describedbyattribute is updated to point to the error message, so the input loses its association to the instructions.
Using aria-errormessage to relate the <input> with the error message would solve both issues.
Steps to reproduce
- Create a form field with instructions and set it to required.
- Submit the form without filling out the field.
Form settings
- Multi-page form: Either
- Submission Method: Either
- Client-side Validation: No
- Custom Form Templates: No
Craft CMS version
5.8.18
Plugin version
3.1.4
Multi-site?
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels