Skip to content

Commit 71c054d

Browse files
authored
Use background-image for native select caret (#594)
1 parent e1bf547 commit 71c054d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/styles/native/select.css

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,11 @@ select:focus,
7373
/* Replace native select caret */
7474
select {
7575
appearance: none;
76-
}
77-
label:has(select) {
78-
position: relative;
79-
--icon-caret: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><path d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>');
8076

81-
&::after {
82-
content: '';
83-
background-color: var(--wa-color-neutral-on-quiet);
84-
mask: var(--icon-caret) 50% 50% no-repeat;
85-
width: 1rem;
86-
height: var(--wa-form-control-height);
87-
position: absolute;
88-
bottom: var(--wa-form-control-border-width);
89-
right: var(--wa-space);
90-
}
77+
--icon-caret: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><path fill="rgb(180 180 200)" d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>');
78+
79+
background-image: var(--icon-caret), var(--icon-caret);
80+
background-repeat: no-repeat;
81+
background-position: center right var(--wa-space);
82+
background-blend-mode: hue, difference;
9183
}

0 commit comments

Comments
 (0)