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

mat-chip-grid sometimes adds aria-required=false without no role #17397

Closed
mertdeg2 opened this issue Oct 14, 2019 · 2 comments · Fixed by #17425 or hrueger/AGLight#112
Closed

mat-chip-grid sometimes adds aria-required=false without no role #17397

mertdeg2 opened this issue Oct 14, 2019 · 2 comments · Fixed by #17425 or hrueger/AGLight#112
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) G This is is related to a Google internal issue P2 The issue is important to a large percentage of users, with a workaround

Comments

@mertdeg2
Copy link
Contributor

Bug, feature request, or proposal:

Bug

What is the expected behavior?

aria-required should only be used when we have valid role attribute.

What is the current behavior?

I am using mdc-chips backed mat-chip-grid implementation. mat-chip-grid component is adding aria-required=false without a role when grid has rows.

What are the steps to reproduce?

  1. Import MDC chips based mat-chip-grid implementation
  2. Paste following template
<mat-chip-grid #chipList>
    <mat-chip-row [removable]="true">
      chip
    </mat-chip-row>
    <input [matChipInputFor]="chipList"
                [matChipInputAddOnBlur]="true"/>
  </mat-chip-grid>
  1. Inspect browser DOM to see mat-chip-grid element has aria-required=false even though it doesn't have role attribute.

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

This is a potential accessibility violation reported by axe. aria-required=false doesn't make sense for non form elements: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-required_attribute

@mertdeg2
Copy link
Contributor Author

Talked to @jelbourn about this bug offline

@jelbourn jelbourn added Accessibility This issue is related to accessibility (a11y) G This is is related to a Google internal issue P2 The issue is important to a large percentage of users, with a workaround labels Oct 14, 2019
@crisbeto crisbeto self-assigned this Oct 16, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 16, 2019
Currently we always set `aria-required` `mat-chip-list`/`mat-chip-grid`, however it should only be set on form controls. If a chip list is empty we remove its role so we also have to clear the `aria-required`.

Fixes angular#17397.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 16, 2019
Currently we always set `aria-required` `mat-chip-list`/`mat-chip-grid`, however it should only be set on form controls. If a chip list is empty we remove its role so we also have to clear the `aria-required`.

Fixes angular#17397.
mmalerba pushed a commit that referenced this issue Oct 17, 2019
Currently we always set `aria-required` `mat-chip-list`/`mat-chip-grid`, however it should only be set on form controls. If a chip list is empty we remove its role so we also have to clear the `aria-required`.

Fixes #17397.
mmalerba pushed a commit that referenced this issue Oct 18, 2019
Currently we always set `aria-required` `mat-chip-list`/`mat-chip-grid`, however it should only be set on form controls. If a chip list is empty we remove its role so we also have to clear the `aria-required`.

Fixes #17397.
@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 Nov 18, 2019
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) G This is is related to a Google internal issue P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
3 participants