Skip to content

Commit ed0a833

Browse files
committed
fix(material/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 73d570a commit ed0a833

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
@@ -21,7 +21,14 @@
2121
</span>
2222
</div>
2323

24-
<div class="mat-select-arrow-wrapper"><div class="mat-select-arrow"></div></div>
24+
<div class="mat-select-arrow-wrapper">
25+
<!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode -->
26+
<div class="mat-select-arrow">
27+
<svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false">
28+
<path d="M7 10l5 5 5-5z"/>
29+
</svg>
30+
</div>
31+
</div>
2532
</div>
2633

2734
<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)