Skip to content

Commit 78d766e

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 e048c2a commit 78d766e

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/lib/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/lib/select/select.scss

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

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

8591
.mat-select-panel {

0 commit comments

Comments
 (0)