Skip to content

Commit 0f333a2

Browse files
crisbetoannieyw
authored andcommitted
fix(material-experimental/mdc-select): arrow not rendering in high contrast mode (#21606)
The MDC select uses a CSS triangle for its down arrow which renders as a rectangle in high contrast mode. These changes switch it to an SVG arrow. These changes are identical to #14219 which had some trouble landing due to screenshot diffs. The MDC select shouldn't have such issues. Relates to #21263. (cherry picked from commit fef9179)
1 parent 4d45db7 commit 0f333a2

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/material-experimental/mdc-select/select.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@
2121
</span>
2222
</div>
2323

24-
<div class="mat-mdc-select-arrow-wrapper"><div class="mat-mdc-select-arrow"></div></div>
24+
<div class="mat-mdc-select-arrow-wrapper">
25+
<div class="mat-mdc-select-arrow">
26+
<!-- 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">
28+
<path d="M7 10l5 5 5-5z"/>
29+
</svg>
30+
</div>
31+
</div>
2532
</div>
2633

2734
<ng-template

src/material-experimental/mdc-select/select.scss

+11-5
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ $scale: 0.75 !default;
6161
}
6262

6363
.mat-mdc-select-arrow {
64-
width: 0;
65-
height: 0;
66-
border-left: $mat-select-arrow-size solid transparent;
67-
border-right: $mat-select-arrow-size solid transparent;
68-
border-top: $mat-select-arrow-size solid;
6964
margin: 0 $mat-select-arrow-margin;
65+
width: $mat-select-arrow-size * 2;
66+
height: $mat-select-arrow-size;
67+
position: relative;
68+
69+
svg {
70+
fill: currentColor;
71+
position: absolute;
72+
top: 50%;
73+
left: 50%;
74+
transform: translate(-50%, -50%);
75+
}
7076
}
7177

7278
// Note that the `.mdc-menu-surface` is here in order to bump up the specificity

0 commit comments

Comments
 (0)