Skip to content

Commit 5a8fa85

Browse files
authored
Merge pull request #84 from BeAPI/feature/better-focus
feat (a11y) focus outline for keyboard event only
2 parents a2995fa + 04a36ba commit 5a8fa85

File tree

6 files changed

+49
-7
lines changed

6 files changed

+49
-7
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"webpack": "^4.32.2",
6868
"webpack-cli": "^3.3.2",
6969
"webpack-manifest-plugin": "^2.0.4",
70-
"webpack-progress-ora-plugin": "^1.2.1"
70+
"webpack-progress-ora-plugin": "^1.2.1",
71+
"what-input": "^5.2.6"
7172
}
7273
}

src/js/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* Main scripts file
33
*/
4+
5+
import 'what-input'
46
import './polyfill/picturefill'
57
import './polyfill/forEach'
68
import './polyfill/objectfit-polyfill'

src/scss/base/_focus.scss

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
html {
2+
a,
3+
button,
4+
input,
5+
select,
6+
textarea {
7+
&:focus {
8+
outline: 2px solid currentColor;
9+
outline-offset: .5rem;
10+
}
11+
}
12+
[data-seo-container] {
13+
&:focus-within {
14+
outline-offset: .5rem;
15+
outline: 1px solid currentColor;
16+
}
17+
*:focus {
18+
outline: none;
19+
}
20+
}
21+
&:not([data-whatintent="keyboard"]) {
22+
a,
23+
button,
24+
input,
25+
select,
26+
textarea {
27+
&:focus {
28+
outline: none;
29+
}
30+
}
31+
[data-seo-container] {
32+
&:focus-within,
33+
*:focus {
34+
outline: none;
35+
}
36+
}
37+
}
38+
}

src/scss/base/_seo.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
[data-seo-container] {
22
position: relative;
33

4-
&:hover,
5-
&:focus-within {
4+
&:hover {
65
cursor: pointer;
76
}
87

9-
&:focus-within {
10-
outline: 1px solid currentColor;
11-
}
12-
138
[data-seo-target] {
149
&:before {
1510
@include pseudo__content;

src/scss/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@import "base/seo";
2626
@import "base/lazyload";
2727
@import "base/layout";
28+
@import "base/focus";
2829

2930
//Wordpress
3031
@import "wp/wpforms";

0 commit comments

Comments
 (0)