-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
AccessibilityThis issue is related to accessibility (a11y)This issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/badgearea: material/icon
Description
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
There is a warning in badge.ts introduced in #27035 about using matBadge on mat-icons, when aria-hidden is set to true (which is the default).
Detected a matBadge on an "aria-hidden" "<mat-icon>". Consider setting aria-hidden="false" in order to surface the information assistive technology.
<mat-icon role="img" matbadge="4" class="mat-icon notranslate mat-badge" aria-hidden="true"></mat-icon>
The following produces the warning:
<mat-icon matBadge="4">home</mat-icon>
Unfortunately, this warning still shows when setting aria-hidden via attr. (which is necessary for setting it conditionally).
The following does still show the warning (unwanted behaviour):
<mat-icon [attr.aria-hidden]="false" matBadge="4">home</mat-icon>
And when trying to set aria-hidden conditionally directly without attr., the following warning appears instead:
Can't bind to 'aria-hidden' since it isn't a known property of 'mat-icon'.
1. If 'mat-icon' is an Angular component and it has 'aria-hidden' input, then verify that it is part of this module.
2. If 'mat-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
Reproduction
Steps to reproduce:
- Load the Page
- Look at the console
Expected Behavior
No Warning
Actual Behavior
Warning in Console
Environment
- Angular: 16.2.0
- CDK/Material: 16.2.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AccessibilityThis issue is related to accessibility (a11y)This issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/badgearea: material/icon