New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(matInput): Screen Readers do not announce that an empty matInput[required]
is invalid
#22777
Labels
Accessibility
This issue is related to accessibility (a11y)
area: material/input
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Comments
ByzantineFailure
added
the
needs triage
This issue needs to be triaged by the team
label
May 24, 2021
ByzantineFailure
added a commit
to ByzantineFailure/components
that referenced
this issue
May 24, 2021
Updates the logic for setting `aria-invalid` on `matInput` to not set the value at all if the input has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes angular#22777
ByzantineFailure
added a commit
to ByzantineFailure/components
that referenced
this issue
May 24, 2021
Updates the logic for setting `aria-invalid` on `matInput` to not set the value at all if the input has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes angular#22777 Add MDC implementation. Whoops.
ByzantineFailure
added a commit
to ByzantineFailure/components
that referenced
this issue
May 24, 2021
Updates the logic for setting `aria-invalid` on `matInput` to not set the value at all if the input has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes angular#22777
ByzantineFailure
added a commit
to ByzantineFailure/components
that referenced
this issue
May 26, 2021
…Input`s Updates the logic for setting `aria-invalid` on `matInput` to not set the attribute at all if the input is `required` and has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes angular#22777
jelbourn
added
Accessibility
This issue is related to accessibility (a11y)
area: material/input
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
and removed
needs triage
This issue needs to be triaged by the team
labels
May 27, 2021
ByzantineFailure
added a commit
to ByzantineFailure/components
that referenced
this issue
Jun 2, 2021
…Input`s Updates the logic for setting `aria-invalid` on `matInput` to not set the attribute at all if the input is `required` and has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes angular#22777
andrewseguin
pushed a commit
that referenced
this issue
Jun 7, 2021
…Input`s (#22802) Updates the logic for setting `aria-invalid` on `matInput` to not set the attribute at all if the input is `required` and has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes #22777
andrewseguin
pushed a commit
that referenced
this issue
Jun 7, 2021
…Input`s (#22802) Updates the logic for setting `aria-invalid` on `matInput` to not set the attribute at all if the input is `required` and has no value. Prior to this PR `matInput` sets `aria-invalid="false"` for any empty `matInput`, including `required` ones. This suppresses screen readers' announcement to users that such inputs are in an invalid state. Fixes #22777 (cherry picked from commit d185294)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Accessibility
This issue is related to accessibility (a11y)
area: material/input
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Reproduction
StackBlitz: https://components-issue-pcy3uq.stackblitz.io
Steps to reproduce:
Expected Behavior
Screen reader announces to the user that the form field is invalid.
Actual Behavior
Screen reader does not announce to the user that the form field is invalid.
Note that while the value in
mat-error
is announced to the user when the field is focused there is no indication that the field itself is invalid (unless the error message itself contains that).Environment
Details
This issue is rooted in the fact that
matInput
setsaria-invalid="false"
for empty inputs. This causes screen readers not to announce that arequired
input is invalid despite being empty.We should update
matInput
to not applyaria-invalid
on instances that do not have any value within the input. This may be accomplished via changing this line within the matInput directive from:to:
Doing this will allow us to comply with the ARIA spec for
aria-invalid
(sincearia-invalid
isn't applied to the element until the user has entered some data) while also providing the correct announcements (sincearia-required
/input[required]
is indicating to the screen reader that the empty field is invalid).Testing methodology
I used this HTML document for testing ARIA attribute behavior with VoiceOver on Chrome and JAWS on Chrome:
Testing with adding/removing various aria attributes on the
input
element showed the following behavior:aria-required
not present,aria-invalid
not presentaria-required
not present,aria-invalid
not presentaria-required="true"
,aria-invalid
not presentaria-required="true"
,aria-invalid
not presentaria-required="true"
,aria-invalid="true"
aria-required="true"
,aria-invalid="true"
aria-required="true"
,aria-invalid="false"
aria-required="true"
,aria-invalid="false"
While I did not test with NVDA/ChromeVox or on FF/IE/etc. I'm reasonably confident that these results will replicate across these use cases as well.
The text was updated successfully, but these errors were encountered: