Skip to content

Commit 6fcdcec

Browse files
authored
fix: broken thin scrollbar color in browser without scrollbar-color support (#95)
1 parent 3baf055 commit 6fcdcec

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/components/scroll/Scroll.css.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,25 @@ export const Scroll = recipe({
8787
},
8888
size: {
8989
"0": {
90-
scrollbarWidth: "none",
90+
"@supports": {
91+
"(scrollbar-color: transparent transparent)": {
92+
scrollbarWidth: "none",
93+
},
94+
},
9195
selectors: {
9296
"&::-webkit-scrollbar": {
9397
display: "none",
9498
},
9599
},
96100
},
97101
"300": {
98-
scrollbarWidth: "thin",
102+
"@supports": {
103+
"(scrollbar-color: transparent transparent)": {
104+
// only apply scrollbarWidth if scrollbar-color is supported,
105+
// otherwise it breaks the colors in some browser like safari.
106+
scrollbarWidth: "thin",
107+
},
108+
},
99109
selectors: {
100110
"&::-webkit-scrollbar": {
101111
width: toRem(8),
@@ -108,7 +118,11 @@ export const Scroll = recipe({
108118
},
109119
},
110120
"400": {
111-
scrollbarWidth: "auto",
121+
"@supports": {
122+
"(scrollbar-color: transparent transparent)": {
123+
scrollbarWidth: "auto",
124+
},
125+
},
112126
selectors: {
113127
"&::-webkit-scrollbar": {
114128
width: toRem(16),

0 commit comments

Comments
 (0)