Skip to content
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

Input being required should not result in aria-invalid="true" #18140

Closed
micamp opened this issue Jan 9, 2020 · 2 comments · Fixed by #21609
Closed

Input being required should not result in aria-invalid="true" #18140

micamp opened this issue Jan 9, 2020 · 2 comments · Fixed by #21609
Assignees
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

@micamp
Copy link

micamp commented Jan 9, 2020

Bug, feature request, or proposal:

Input being required should not result in aria-invalid="true".

What is the expected behavior?

An input field that is required should be marked as required in the HTML (which it is), but should not be marked as aria-invalid until the user enters an invalid value.

What is the current behavior?

An input field that is required is marked as both required and aria-invalid before any content is entered by the user.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

  1. Open the AM input example page
  2. Find the "Input with a custom ErrorStateMatcher" example
  3. Inspect the HTML of the input

Expected: The input element should have aria-invalid="false" or no aria-invalid attribute.
Actual: The input element has aria-invalid="true".

What is the use-case or motivation for changing an existing behavior?

It is confusing to users with a screen reader why it would be invalid before they have even entered any content.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest. It is on your example page.

Is there anything else we should know?

Thank you for your attention on this issue.

@jelbourn jelbourn added Accessibility This issue is related to accessibility (a11y) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Feb 6, 2020
@IAfanasov
Copy link

Can not reproduce it on the current version 9.2.1. The aria-invalid is set to false. Screen record:

aria-invalid-false

Tested on Mac, browsers Chrome, Brave and Firefox

crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 15, 2021
Only sets `aria-invalid` on a `MatInput` if it is invalid and it has a value, otherwise it'll likely
overlap with `aria-required` and cause more noise for users. Furthermore, it may be
confusing if the user lands on an input that they haven't interacted with, but it's already
invalid.

Fixes angular#18140.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 15, 2021
Only sets `aria-invalid` on a `MatInput` if it is invalid and it has a value, otherwise it'll likely
overlap with `aria-required` and cause more noise for users. Furthermore, it may be
confusing if the user lands on an input that they haven't interacted with, but it's already
invalid.

Fixes angular#18140.
mmalerba pushed a commit that referenced this issue Feb 10, 2021
#21609)

Only sets `aria-invalid` on a `MatInput` if it is invalid and it has a value, otherwise it'll likely
overlap with `aria-required` and cause more noise for users. Furthermore, it may be
confusing if the user lands on an input that they haven't interacted with, but it's already
invalid.

Fixes #18140.
mmalerba pushed a commit that referenced this issue Feb 10, 2021
#21609)

Only sets `aria-invalid` on a `MatInput` if it is invalid and it has a value, otherwise it'll likely
overlap with `aria-required` and cause more noise for users. Furthermore, it may be
confusing if the user lands on an input that they haven't interacted with, but it's already
invalid.

Fixes #18140.

(cherry picked from commit d0c53ac)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 13, 2021
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants