Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 6f97632

Browse files
kfranqueiroKenneth G. Franqueiro
authored andcommitted
docs(button): Add aria-hidden="true" to icon elements (#2582)
1 parent 30710a4 commit 6f97632

File tree

11 files changed

+101
-101
lines changed

11 files changed

+101
-101
lines changed

demos/button.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
119119
Secondary
120120
</button>
121121
<button class="mdc-button">
122-
<i class="material-icons mdc-button__icon">favorite</i>
122+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
123123
Icon
124124
</button>
125125
<button class="mdc-button">
126-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
126+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
127127
<path fill="none" d="M0 0h24v24H0z"/>
128128
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
129129
</svg>
@@ -148,11 +148,11 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
148148
Secondary
149149
</button>
150150
<button class="mdc-button mdc-button--raised">
151-
<i class="material-icons mdc-button__icon">favorite</i>
151+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
152152
Icon
153153
</button>
154154
<button class="mdc-button mdc-button--raised">
155-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
155+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
156156
<path fill="none" d="M0 0h24v24H0z"/>
157157
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
158158
</svg>
@@ -177,11 +177,11 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
177177
Secondary
178178
</button>
179179
<button class="mdc-button mdc-button--unelevated">
180-
<i class="material-icons mdc-button__icon">favorite</i>
180+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
181181
Icon
182182
</button>
183183
<button class="mdc-button mdc-button--unelevated">
184-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
184+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
185185
<path fill="none" d="M0 0h24v24H0z"/>
186186
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
187187
</svg>
@@ -206,11 +206,11 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
206206
Secondary
207207
</button>
208208
<button class="mdc-button mdc-button--stroked">
209-
<i class="material-icons mdc-button__icon">favorite</i>
209+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
210210
Icon
211211
</button>
212212
<button class="mdc-button mdc-button--stroked">
213-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
213+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
214214
<path fill="none" d="M0 0h24v24H0z"/>
215215
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
216216
</svg>
@@ -238,11 +238,11 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
238238
<legend class="mdc-typography--headline6">Different Color Icons/Ink</legend>
239239
<div>
240240
<button class="mdc-button mdc-button--unelevated demo-ink-color">
241-
<i class="material-icons mdc-button__icon">favorite</i>
241+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
242242
Ink Color
243243
</button>
244244
<button class="mdc-button mdc-button--stroked demo-icon-color">
245-
<i class="material-icons mdc-button__icon">favorite</i>
245+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
246246
Icon Color
247247
</button>
248248
</div>
@@ -262,11 +262,11 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
262262
Secondary
263263
</button>
264264
<button class="mdc-button" data-demo-no-js>
265-
<i class="material-icons mdc-button__icon">favorite</i>
265+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
266266
Icon
267267
</button>
268268
<button class="mdc-button" data-demo-no-js>
269-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
269+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
270270
<path fill="none" d="M0 0h24v24H0z"/>
271271
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
272272
</svg>
@@ -291,11 +291,11 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
291291
Secondary
292292
</button>
293293
<button class="mdc-button mdc-button--raised" data-demo-no-js>
294-
<i class="material-icons mdc-button__icon">favorite</i>
294+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
295295
Icon
296296
</button>
297297
<button class="mdc-button mdc-button--raised" data-demo-no-js>
298-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
298+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
299299
<path fill="none" d="M0 0h24v24H0z"/>
300300
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
301301
</svg>
@@ -320,11 +320,11 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
320320
Secondary
321321
</button>
322322
<button class="mdc-button mdc-button--unelevated" data-demo-no-js>
323-
<i class="material-icons mdc-button__icon">favorite</i>
323+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
324324
Icon
325325
</button>
326326
<button class="mdc-button mdc-button--unelevated" data-demo-no-js>
327-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
327+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
328328
<path fill="none" d="M0 0h24v24H0z"/>
329329
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
330330
</svg>
@@ -350,11 +350,11 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
350350
Secondary
351351
</button>
352352
<button class="mdc-button mdc-button--stroked" data-demo-no-js>
353-
<i class="material-icons mdc-button__icon">favorite</i>
353+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
354354
Icon
355355
</button>
356356
<button class="mdc-button mdc-button--stroked" data-demo-no-js>
357-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
357+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000">
358358
<path fill="none" d="M0 0h24v24H0z"/>
359359
<path d="M23 12c0-6.07-4.93-11-11-11S1 5.93 1 12s4.93 11 11 11 11-4.93 11-11zM5 17.64C3.75 16.1 3 14.14 3 12c0-2.13.76-4.08 2-5.63v11.27zM17.64 5H6.36C7.9 3.75 9.86 3 12 3s4.1.75 5.64 2zM12 14.53L8.24 7h7.53L12 14.53zM17 9v8h-4l4-8zm-6 8H7V9l4 8zm6.64 2c-1.55 1.25-3.51 2-5.64 2s-4.1-.75-5.64-2h11.28zM21 12c0 2.14-.75 4.1-2 5.64V6.37c1.24 1.55 2 3.5 2 5.63z"/>
360360
</svg>
@@ -382,11 +382,11 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
382382
<legend class="mdc-typography--headline6">Different Color Icons/Ink</legend>
383383
<div>
384384
<button class="mdc-button mdc-button--unelevated demo-ink-color" data-demo-no-js>
385-
<i class="material-icons mdc-button__icon">favorite</i>
385+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
386386
Ink Color
387387
</button>
388388
<button class="mdc-button mdc-button--stroked demo-icon-color" data-demo-no-js>
389-
<i class="material-icons mdc-button__icon">favorite</i>
389+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
390390
Icon Color
391391
</button>
392392
</div>

docs/theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ Then apply the custom class to the button elements:
450450

451451
```html
452452
<button class="mdc-button accessible-button">
453-
<i class="material-icons mdc-button__icon">favorite</i>
453+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
454454
Button
455455
</button>
456456
```

packages/mdc-button/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ semantically correct.
5555
### Adding Icon
5656

5757
Users can nest `mdc-button__icon` inside the button element to add an icon. The icon in button
58-
is set to 18px to meet legibility requirements.
58+
is set to 18px to meet legibility requirements. This element should also include `aria-hidden="true"`.
5959

60-
We recommend you load [Material Icons](https://material.io/icons/) from Google Fonts
60+
We recommend you load [Material Icons](https://material.io/icons/) from Google Fonts:
6161

6262
```html
6363
<head>
6464
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
6565
</head>
6666

6767
<button class="mdc-button">
68-
<i class="material-icons mdc-button__icon">favorite</i>
68+
<i class="material-icons mdc-button__icon" aria-hidden="true">favorite</i>
6969
Button
7070
</button>
7171
```
@@ -74,7 +74,7 @@ It's also possible to use an SVG icon:
7474

7575
```html
7676
<button class="mdc-button">
77-
<svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="...">
77+
<svg class="mdc-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="...">
7878
...
7979
</svg>
8080
SVG Icon

0 commit comments

Comments
 (0)