Skip to content

Commit b6de33c

Browse files
authored
Merge pull request #358 from UniversityofWarwick/ID-479
ID-479 focus-visible outlines.
2 parents f5ef523 + 324c700 commit b6de33c

7 files changed

Lines changed: 17 additions & 19 deletions

File tree

bootstrap/less/buttons.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
cursor: pointer;
3737
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
3838
border: 1px solid transparent;
39-
39+
4040
.user-select(none);
4141
text-decoration: none;
4242

@@ -49,7 +49,7 @@
4949
&,
5050
&:active,
5151
&.active {
52-
&:focus,
52+
&:focus-visible,
5353
&.focus {
5454
.tab-focus();
5555
}

bootstrap/less/forms.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ select[size] {
9494
}
9595

9696
// Focus for file, radio, and checkbox
97-
input[type="file"]:focus,
98-
input[type="radio"]:focus,
99-
input[type="checkbox"]:focus {
97+
input[type="file"]:focus-visible,
98+
input[type="radio"]:focus-visible,
99+
input[type="checkbox"]:focus-visible {
100100
.tab-focus();
101101
}
102102

bootstrap/less/scaffolding.less

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ a {
5252
color: var(--w-sys-colors-link);
5353
text-decoration: none;
5454

55-
&:hover,
56-
&:focus {
57-
color: var(--w-sys-colors-link-hover);
55+
&:hover {
56+
color: var(--w-sys-colors-link-hover);
5857
text-decoration: @link-hover-decoration;
5958
}
6059

61-
&:focus {
60+
&:focus-visible {
6261
.tab-focus();
6362
}
6463
}

less/accessibility.less

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
:root {
2-
--w-ref-focusOutline: @focus-outline;
3-
--w-sys-focusOutline: var(--w-ref-focusOutline);
2+
--w-sys-focusOutline: @focus-outline;
43
}
54

65
.id7-outline() {
76
outline: 3px solid var(--w-sys-focusOutline);
87
color: #0b0c0c !important;
98
background-color: var(--w-sys-focusOutline) !important;
10-
box-shadow: 0 -2px var(--w-sys-focusOutline), 0 6px #0b0c0c;
9+
box-shadow: 0 -2px var(--w-sys-focusOutline), 0 9px #0b0c0c;
1110
text-decoration: none !important;
1211
transition-duration: 0s;
1312
}
@@ -19,15 +18,15 @@
1918
.id7-outline();
2019
}
2120

22-
a:focus img {
21+
a:focus-visible img {
2322
background-color: var(--w-sys-focusOutline)
2423
}
2524

2625
a:focus .id7-notifications-badge .counter-value {
2726
color: white;
2827
}
2928

30-
.open > a:focus, .dropdown-menu > .active > a:focus, .dropdown-toggle:focus, [role="button"]:focus {
29+
.open > a:focus-visible, .dropdown-menu > .active > a:focus-visible, .dropdown-toggle:focus-visible, [role="button"]:focus-visible {
3130
.id7-outline();
3231
}
3332

less/hp-2025/hp.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ h3, .h3 { font-size: ceil((26px * @font-scale-xs)); }
711711
}
712712
}
713713

714-
html & .form-control:focus {
714+
html & .form-control:focus-visible {
715715
.tab-focus();
716716
}
717717

less/navigation.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338
margin: 0 0 0 4px;
339339
padding: 0;
340340

341-
&:focus {
341+
&:focus-visible {
342342
.tab-focus();
343343
}
344344
}

less/search.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
color: var(--w-sys-colors-primary-500);
3838
}
3939

40-
&:focus {
40+
&:focus-visible {
4141
.tab-focus();
42+
}
43+
&:focus {
4244
.fas {
4345
color: var(--w-sys-colors-primary-500);
4446
}
4547
}
4648
}
4749

48-
49-
5050
// These typeahead rules only apply to the non-homepage search box
5151
// that lives inside the search box container. The homepage places
5252
// it in the masthead and the plugin does positioning.

0 commit comments

Comments
 (0)