You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(material/icon): hides .mdc-button .mat-icon on mobile screens
Updates previous fix by updating documentation on the usage of
mat-icon within mdc-button to notify developers that mat-icon
is set to be hidden on mobile/xsmall screens to improve
accessibility and recommends the usage of aria-label or
aria-labelledby to notify screenreaders of the information that
mat-icon is supposed to convey.
Fixes b/250063405
Copy file name to clipboardExpand all lines: src/material/icon/icon.md
+9
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,15 @@ information as the icon.
117
117
2. Add the `cdk-visually-hidden` class to the `<span>`. This will make the message invisible
118
118
on-screen but still available to screen-reader users.
119
119
120
+
##### Interactive / Indicator icons within a button
121
+
**Note that when the presence of an icon in a button is supposed to communicate some
122
+
information to the user or by being inlined into a block of text, as mentioned by
123
+
Interactive icons above, an appropriate element should "own" the icon with interaction:
124
+
* The `<mat-icon>` element should be a child of a `<button>` or `<a>` element.
125
+
* The parent `<button>` or `<a>` should either have a meaningful label provided either through
126
+
direct text content, `aria-label`, or `aria-labelledby`.
127
+
* On mobile/small screens for these icons inlined with text in a button, the icon visibility is set to `hidden` to avoid overlapping into other elements and improve accessibility.
128
+
120
129
### Bidirectionality
121
130
122
131
By default icons in an RTL layout will look exactly the same as in LTR, however certain icons have
0 commit comments