Skip to content

Commit

Permalink
fix(material-experimental/mdc-select): arrow not rendering in high co…
Browse files Browse the repository at this point in the history
…ntrast mode

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 angular#14219 which had some trouble landing due to screenshot
diffs. The MDC select shouldn't have such issues.

Relates to angular#21263.
  • Loading branch information
crisbeto committed Jan 15, 2021
1 parent 73d570a commit f6aa10e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/material-experimental/mdc-select/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
</span>
</div>

<div class="mat-mdc-select-arrow-wrapper"><div class="mat-mdc-select-arrow"></div></div>
<div class="mat-mdc-select-arrow-wrapper">
<div class="mat-mdc-select-arrow">
<!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode. -->
<svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false">
<path d="M7 10l5 5 5-5z"/>
</svg>
</div>
</div>
</div>

<ng-template
Expand Down
16 changes: 11 additions & 5 deletions src/material-experimental/mdc-select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ $scale: 0.75 !default;
}

.mat-mdc-select-arrow {
width: 0;
height: 0;
border-left: $mat-select-arrow-size solid transparent;
border-right: $mat-select-arrow-size solid transparent;
border-top: $mat-select-arrow-size solid;
margin: 0 $mat-select-arrow-margin;
width: $mat-select-arrow-size * 2;
height: $mat-select-arrow-size;
position: relative;

svg {
fill: currentColor;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}

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

0 comments on commit f6aa10e

Please sign in to comment.