Skip to content

Commit fa48769

Browse files
committed
fix(select): arrow not rendering correctly in high contrast mode
Since all borders get rendered out in high contrast mode, we can't use a CSS triangle to render out the `mat-select` dropdown arrow. These changes replace it with an SVG arrow. Fixes #14207.
1 parent 6a7fc81 commit fa48769

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/material/select/select.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
</span>
1313
</div>
1414

15-
<div class="mat-select-arrow-wrapper"><div class="mat-select-arrow"></div></div>
15+
<div class="mat-select-arrow-wrapper">
16+
<!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode -->
17+
<div class="mat-select-arrow">
18+
<svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false">
19+
<path d="M7 10l5 5 5-5z"/>
20+
</svg>
21+
</div>
22+
</div>
1623
</div>
1724

1825
<ng-template

src/material/select/select.scss

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,18 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
7575
}
7676

7777
.mat-select-arrow {
78-
width: 0;
79-
height: 0;
80-
border-left: $mat-select-arrow-size solid transparent;
81-
border-right: $mat-select-arrow-size solid transparent;
82-
border-top: $mat-select-arrow-size solid;
8378
margin: 0 $mat-select-arrow-margin;
79+
width: $mat-select-arrow-size * 2;
80+
height: $mat-select-arrow-size;
81+
position: relative;
82+
83+
svg {
84+
fill: currentColor;
85+
position: absolute;
86+
top: 50%;
87+
left: 50%;
88+
transform: translate(-50%, -50%);
89+
}
8490
}
8591

8692
.mat-select-panel-wrap {

0 commit comments

Comments
 (0)