Skip to content

Commit cc18294

Browse files
committed
:lisptick: ♿ add focus-visible with polyfill
1 parent fdc918d commit cc18294

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/styles/GlobalStyle.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,31 @@ const GlobalStyle = createGlobalStyle`
2424
color: var(--lightest-slate);
2525
}
2626
27+
/* Provide basic, default focus styles.*/
2728
:focus {
2829
outline: 2px dashed var(--green);
2930
outline-offset: 3px;
3031
}
3132
33+
/*
34+
Remove default focus styles for mouse users ONLY if
35+
:focus-visible is supported on this platform.
36+
*/
37+
:focus:not(:focus-visible) {
38+
outline: none;
39+
outline-offset: 0px;
40+
}
41+
42+
/*
43+
Optionally: If :focus-visible is supported on this
44+
platform, provide enhanced focus styles for keyboard
45+
focus.
46+
*/
47+
:focus-visible {
48+
outline: 2px dashed var(--green);
49+
outline-offset: 3px;
50+
}
51+
3252
/* Scrollbar Styles */
3353
html {
3454
scrollbar-width: thin;

0 commit comments

Comments
 (0)