instructure / instructure/instructure-ui
Missing aria-live and aria-errormessage attributes in form field components
@matyasf is already working on this.
Since Mar 21, 2025.
- Dominant language
- TypeScript
- Stars
- 480
- Forks
- 108
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 16
Description
Background Information
Package Version(s):
- ui-form-field v10.14.0
- ui-select v10.14.0
- ui-simple-select v10.14.0
- ui-text-input v10.14.0
Browser: Chrome (observed), potentially all
Screen Reader: Mac VoiceOver (tested), potentially all
Component: FormFieldLayout, Select, SimpleSelect, TextInput
Describe the Issue
Accessibility issues in form field components:
-
Error messages are not automatically announced by screen readers due to missing
aria-liveandrole="alert"attributes -
The
aria-errormessageattribute is not being propagated from FormFieldLayout down to input elements -
The
aria-errormessageattribute does not match the ID of the error message container
Steps To Reproduce
- Render a Select or SimpleSelect with error messages
- Verify that input elements have
aria-invalidbut are missingaria-errormessage - Trigger form validation errors
- Error messages are not automatically announced (unless focus is on the invalid input)
Expected Behavior
-
Error message container should:
- Have
aria-live="assertive"androle="alert"for error messages - Be persistently in the DOM
- Have
-
Input elements should have both
aria-invalid="true"andaria-errormessagepointing to message container ID -
Error message container should have an ID matching
aria-errormessage
Additional Information
Current Workaround(s): At the moment we are duplicating error messages in a ScreenReaderContent with aria-live="assertive" and role="alert" to ensure they are announced
Products Affected: All form field components
Are you willing to submit a PR to fix?
- Yes, I'm willing to submit a PR
- (I may have a speculative fix...)
WCAG Guidelines
- 1.3.1 Info and Relationships (Level A)
- 4.1.2 Name, Role, Value (Level A)
- 3.3.1 Error Identification (Level A)
- 4.1.3 Status Messages (Level AA)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.