Skip to content

Commit b62343a

Browse files
crisbetojelbourn
authored andcommitted
fix(form-field): remove chevron from native multi-select (#13009)
Removes the chevron icon from native selects in multiple mode, because they're rendered inline.
1 parent 50be24b commit b62343a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/lib/input/input.scss

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ textarea.mat-input-element {
122122
margin: -2px 0;
123123
}
124124

125-
// Encoded material design select arrow svg
126-
/* stylelint-disable max-line-length */
127-
$mat-native-select-arrow-svg: 'data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%2210%22%20height%3D%225%22%20viewBox%3D%227%2010%2010%205%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%230%22%20fill-rule%3D%22evenodd%22%20opacity%3D%22.54%22%20d%3D%22M7%2010l5%205%205-5z%22%2F%3E%3C%2Fsvg%3E';
128-
/* stylelint-enable */
125+
// URL-encoded Material Design select arrow SVG.
126+
$mat-native-select-arrow-svg: '' +
127+
'data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%2210%22%20height%3D%225%22%20' +
128+
'viewBox%3D%227%2010%2010%205%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fs' +
129+
'vg%22%3E%3Cpath%20fill%3D%22%230%22%20fill-rule%3D%22evenodd%22%20opacity%3D%22' +
130+
'.54%22%20d%3D%22M7%2010l5%205%205-5z%22%2F%3E%3C%2Fsvg%3E';
129131

130132
// Remove the native select down arrow and replace it with material design arrow
131133
select.mat-input-element {
@@ -136,12 +138,17 @@ select.mat-input-element {
136138
-webkit-appearance: none;
137139
position: relative;
138140
background-color: transparent;
139-
background-image: url($mat-native-select-arrow-svg);
140141
background-repeat: no-repeat;
141142
display: inline-flex;
142143
box-sizing: border-box;
143144
background-position: right center;
144145

146+
// Native multi-selects are rendered inline which
147+
// means that they shouldn't have a dropdown arrow.
148+
&:not([multiple]) {
149+
background-image: url($mat-native-select-arrow-svg);
150+
}
151+
145152
[dir='rtl'] & {
146153
background-position: left center;
147154
}

0 commit comments

Comments
 (0)