Closed
Description
Feature Description
From usages across Google, we've seen that's it's common for devs to put matBadge
on <mat-icon>
. The problem is that <mat-icon>
is aria-hidden
by default, meaning that the badge content is also invisible to screen readers. Our documentation already calls this out as a misuse of the badge, but we can go a step further and actually produce a console warning. This would look something roughly like
if (ngDevMode && host.nodeName === 'mat-icon' && host.getAttribute('aria-hidden') === 'true') {
console.warn('Warning: detected matBadge on a "<mat-icon>" with "aria-hidden="true"\n${host.outerHTML}');
}