Skip to content

Commit 6586f12

Browse files
committed
fix(component-library): fix focus colors
1 parent 1261d33 commit 6586f12

File tree

6 files changed

+35
-16
lines changed

6 files changed

+35
-16
lines changed

apps/insights/src/components/CopyButton/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
}
5151

5252
&[data-focus-visible] {
53-
outline: 1px auto currentcolor;
53+
outline: 1px solid currentcolor;
5454
outline-offset: theme.spacing(1);
5555
}
5656

packages/component-library/src/Button/index.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
}
129129

130130
&[data-focus-visible] {
131-
border-color: theme.color("forms", "input", "focus", "border");
132-
box-shadow: 0px 0px 0px 4px theme.color("forms", "focus-color");
131+
border-color: theme.color("focus");
132+
@include theme.shadow("focus");
133133
}
134134
}

packages/component-library/src/SearchInput/index.module.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
overflow: hidden;
2626
text-overflow: ellipsis;
2727
white-space: nowrap;
28-
caret-color: theme.color("forms", "input", "focus", "border");
28+
caret-color: theme.color("focus");
2929

3030
&::-webkit-search-cancel-button {
3131
display: none;
@@ -36,8 +36,9 @@
3636
}
3737

3838
&[data-focused] {
39-
border-color: theme.color("forms", "input", "focus", "border");
40-
box-shadow: 0px 0px 0px 4px theme.color("forms", "focus-color");
39+
border-color: theme.color("focus");
40+
41+
@include theme.shadow("focus");
4142
}
4243

4344
:placeholder {

packages/component-library/src/Select/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
}
7373

7474
&[data-focus-visible] {
75-
box-shadow: 0px 0px 0px 4px theme.color("forms", "focus-color");
75+
outline: theme.color("focus-dim") solid 1px;
7676
}
7777

7878
&[data-selected] .check {

packages/component-library/src/Table/index.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
.loader {
1717
width: 100%;
1818
height: 100%;
19-
background-color: theme.color("forms", "input", "focus", "border");
19+
background-color: theme.color("focus");
2020
transform-origin: left;
2121
animation: progress 1s infinite linear;
2222

@@ -91,7 +91,7 @@
9191
}
9292

9393
&[data-focus-visible] {
94-
outline: theme.color("forms", "input", "focus", "border") auto 1px;
94+
outline: theme.color("focus") solid 1px;
9595
}
9696

9797
&[data-href] {
@@ -137,7 +137,7 @@
137137
}
138138

139139
&[data-focus-visible] {
140-
outline: theme.color("forms", "input", "focus", "border") auto 1px;
140+
outline: theme.color("focus") solid 1px;
141141
}
142142
}
143143
}

packages/component-library/src/theme.scss

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,18 @@ $color: (
423423
light-dark(pallette-color("steel", 900), pallette-color("steel", 50)),
424424
),
425425
),
426+
"focus":
427+
light-dark(pallette-color("violet", 700), pallette-color("violet", 500)),
428+
"focus-dim":
429+
light-dark(
430+
rgba(pallette-color("violet", 700), 0.3),
431+
rgba(pallette-color("violet", 500), 0.3)
432+
),
426433
"forms": (
427-
"focus-color": light-dark(rgba(#7142cf, 0.2), rgba(#7b4cd9, 0.2)),
428434
"input": (
429435
"hover": (
430436
"border": pallette-color("stone", 400),
431437
),
432-
"focus": (
433-
"border": pallette-color("steel", 500),
434-
),
435438
),
436439
),
437440
"button": (
@@ -481,8 +484,16 @@ $color: (
481484
"foreground":
482485
light-dark(pallette-color("stone", 900), pallette-color("steel", 50)),
483486
"background": (
484-
"hover": light-dark(rgba(#715858, 0.05), rgba(#e9ecff, 0.05)),
485-
"active": light-dark(rgba(#715858, 0.1), rgba(#e9ecff, 0.1)),
487+
"hover":
488+
light-dark(
489+
rgba(pallette-color("beige", 950), 0.05),
490+
rgba(pallette-color("steel", 50), 0.05)
491+
),
492+
"active":
493+
light-dark(
494+
rgba(pallette-color("beige", 950), 0.1),
495+
rgba(pallette-color("steel", 50), 0.1)
496+
),
486497
),
487498
),
488499
"disabled": (
@@ -544,6 +555,13 @@ $button-sizes: (
544555
@return map-get-strict($button-sizes, $size, "icon-size");
545556
}
546557

558+
$shadows: (
559+
"focus": 0px 0px 0px 4px color("focus-dim"),
560+
);
561+
@mixin shadow($shadow...) {
562+
box-shadow: map-get-strict($shadows, $shadow...);
563+
}
564+
547565
@mixin sr-only {
548566
position: absolute;
549567
width: 1px;

0 commit comments

Comments
 (0)