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

bug(mat-chip-grid): mat-error instances are not exposed to screen reader users #24542

Closed
1 task
ByzantineFailure opened this issue Mar 7, 2022 · 2 comments · Fixed by #24551
Closed
1 task
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@ByzantineFailure
Copy link
Contributor

ByzantineFailure commented Mar 7, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When a mat-chip-grid has a mat-error associated with it SR users do not hear the error when they focus the grid or its associated matChipInput.

Reproduction

Steps to reproduce:

  1. Load this stackblitz: https://stackblitz.com/edit/components-issue-keh175
  2. Turn on the Screen Reader of your choice
  3. Tab to the chip input
  4. Enter any value and hit enter. You should see an error appear and you should hear it be announced.
  5. Tab back to the button above or the button below, then tab back to either the input or chip grid

Expected Behavior

The SR reads out the error message when the user focuses either the chip grid or the chip input.

Actual Behavior

The SR does not read out the error message. Additionally, it does not indicate that the field is invalid until the matChipInput is focused. This seems to be the result of the on-focus behavior of MatChipGrid combined with the way the form field is associating the error with its control.

When a form field has an error associated with it, AM will generally try to add aria-describedby=ERROR_ELEMENT_ID. In this particular case, the control that the error is associated with is the mat-chip-grid element. However, when focus lands on a chip grid it focuses the first chip if any are available, or otherwise moves the focus to the input if one is present. Effectively, this means that the user cannot ever hear the error message be announced while focused on the control itself.

Environment

  • Angular: 13.2.5
  • CDK/Material: 13.2.5
  • Browser(s): Any
  • Operating System (e.g. Windows, macOS, Ubuntu): Any
@ByzantineFailure ByzantineFailure added the needs triage This issue needs to be triaged by the team label Mar 7, 2022
@ByzantineFailure
Copy link
Contributor Author

This might be solvable by updating mat-chip-grid to propagate its aria-describedby value to the matChipInput associated with it.

ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 8, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Fixes angular#24542
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr area: material/chips and removed needs triage This issue needs to be triaged by the team labels Mar 15, 2022
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 15, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Fixes angular#24542
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 15, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 21, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 21, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 25, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
ByzantineFailure added a commit to ByzantineFailure/components that referenced this issue Mar 25, 2022
…hipInput

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
andrewseguin pushed a commit that referenced this issue Mar 25, 2022
…hipInput (#24551)

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes #24542
andrewseguin pushed a commit that referenced this issue Mar 25, 2022
…hipInput (#24551)

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes #24542

(cherry picked from commit 1bc98ec)
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…hipInput (angular#24551)

Updates mat-chip-grid to associate any ids set for aria-describedby to
the matChipInput instance within the grid, if one exists.

Removes the aria-describedby attribute on the grid itself since it never
receives focus.

Fixes angular#24542
@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 Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants