Skip to content

Commit 12474aa

Browse files
committed
fix(multiple): set aria-hidden on presentational svgs (#27116)
Adds `aria-hidden` on all SVG nodes that didn't have them already to prevent them from being treated as images. Fixes #27113. (cherry picked from commit b637301)
1 parent d7b8cce commit 12474aa

File tree

7 files changed

+25
-12
lines changed

7 files changed

+25
-12
lines changed

src/material/chips/chip-option.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
<span class="mdc-evolution-chip__graphic mat-mdc-chip-graphic" *ngIf="_hasLeadingGraphic()">
1717
<ng-content select="mat-chip-avatar, [matChipAvatar]"></ng-content>
1818
<span class="mdc-evolution-chip__checkmark">
19-
<svg class="mdc-evolution-chip__checkmark-svg" viewBox="-2 -3 30 30" focusable="false">
19+
<svg
20+
class="mdc-evolution-chip__checkmark-svg"
21+
viewBox="-2 -3 30 30"
22+
focusable="false"
23+
aria-hidden="true">
2024
<path class="mdc-evolution-chip__checkmark-path"
2125
fill="none" stroke="currentColor" d="M1.73,12.91 8.1,19.28 22.79,4.59" />
2226
</svg>
@@ -35,4 +39,4 @@
3539
<ng-content select="mat-chip-trailing-icon,[matChipRemove],[matChipTrailingIcon]"></ng-content>
3640
</span>
3741

38-
<span class="cdk-visually-hidden" [id]="_ariaDescriptionId">{{ariaDescription}}</span>
42+
<span class="cdk-visually-hidden" [id]="_ariaDescriptionId">{{ariaDescription}}</span>

src/material/datepicker/datepicker-toggle.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
width="24px"
1616
height="24px"
1717
fill="currentColor"
18-
focusable="false">
18+
focusable="false"
19+
aria-hidden="true">
1920
<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"/>
2021
</svg>
2122

src/material/legacy-menu/menu-item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
*ngIf="_triggersSubmenu"
99
class="mat-menu-submenu-icon"
1010
viewBox="0 0 5 10"
11-
focusable="false"><polygon points="0,0 5,5 0,10"/></svg>
11+
focusable="false"
12+
aria-hidden="true"><polygon points="0,0 5,5 0,10"/></svg>

src/material/legacy-paginator/paginator.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
[matTooltipPosition]="'above'"
4343
[disabled]="_previousButtonsDisabled()"
4444
*ngIf="showFirstLastButtons">
45-
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">
45+
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
4646
<path d="M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"/>
4747
</svg>
4848
</button>
@@ -54,7 +54,7 @@
5454
[matTooltipDisabled]="_previousButtonsDisabled()"
5555
[matTooltipPosition]="'above'"
5656
[disabled]="_previousButtonsDisabled()">
57-
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">
57+
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
5858
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
5959
</svg>
6060
</button>
@@ -66,7 +66,7 @@
6666
[matTooltipDisabled]="_nextButtonsDisabled()"
6767
[matTooltipPosition]="'above'"
6868
[disabled]="_nextButtonsDisabled()">
69-
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">
69+
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
7070
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
7171
</svg>
7272
</button>
@@ -79,7 +79,7 @@
7979
[matTooltipPosition]="'above'"
8080
[disabled]="_nextButtonsDisabled()"
8181
*ngIf="showFirstLastButtons">
82-
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">
82+
<svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
8383
<path d="M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"/>
8484
</svg>
8585
</button>

src/material/menu/menu-item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
*ngIf="_triggersSubmenu"
99
class="mat-mdc-menu-submenu-icon"
1010
viewBox="0 0 5 10"
11-
focusable="false"><polygon points="0,0 5,5 0,10"/></svg>
11+
focusable="false"
12+
aria-hidden="true"><polygon points="0,0 5,5 0,10"/></svg>

src/material/select/select.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="mat-mdc-select-arrow-wrapper">
2525
<div class="mat-mdc-select-arrow">
2626
<!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode. -->
27-
<svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false">
27+
<svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false" aria-hidden="true">
2828
<path d="M7 10l5 5 5-5z"/>
2929
</svg>
3030
</div>

src/material/slide-toggle/slide-toggle.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@
3232
[matRippleCentered]="true"></div>
3333
</div>
3434
<div class="mdc-switch__icons">
35-
<svg class="mdc-switch__icon mdc-switch__icon--on" viewBox="0 0 24 24">
35+
<svg
36+
class="mdc-switch__icon mdc-switch__icon--on"
37+
viewBox="0 0 24 24"
38+
aria-hidden="true">
3639
<path d="M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z" />
3740
</svg>
38-
<svg class="mdc-switch__icon mdc-switch__icon--off" viewBox="0 0 24 24">
41+
<svg
42+
class="mdc-switch__icon mdc-switch__icon--off"
43+
viewBox="0 0 24 24"
44+
aria-hidden="true">
3945
<path d="M20 13H4v-2h16v2z" />
4046
</svg>
4147
</div>

0 commit comments

Comments
 (0)