Skip to content

fix(mdc chips) Don't let MDC set aria-checked attribute on option chips #16530

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

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/material-experimental/mdc-chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
},
hasLeadingIcon: () => { return !!this.leadingIcon; },
setAttr: (name: string, value: string) => {
// MDC is currently using this method to set aria-checked on choice and filter chips,
// which in the MDC templates have role="checkbox" and role="radio" respectively.
// We have role="option" on those chips instead, so we do not want aria-checked.
if (name === 'aria-checked') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you file an issue on the MDC repo about this? I would consider it overzealous.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return;
}
this._elementRef.nativeElement.setAttribute(name, value);
},
// The 2 functions below are used by the MDC ripple, which we aren't using,
Expand Down