Skip to content

Commit 4144b2e

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 098df82 commit 4144b2e

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-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: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,21 @@ $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+
87+
// Note that we use specific values here in order to position the arrow exactly
88+
// where the old one used to be and to avoid screenshot diff failures.
89+
top: 2px;
90+
left: 5px;
91+
transform: translate(-50%, -50%);
92+
}
8493
}
8594

8695
.mat-select-panel-wrap {

0 commit comments

Comments
 (0)