Skip to content

Commit 951e6c0

Browse files
authored
Fix: aria-label class not properly hidden (fixes #606) (#611)
1 parent 1f3aa0d commit 951e6c0

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

less/core/accessibility.less

+25-24
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@
33
.component { position: relative; }
44
.block { position: relative; }
55

6-
// jquery.a11y start
7-
// Invisible aria-labels
8-
// --------------------------------------------------
9-
.aria-label {
10-
position: absolute !important;
11-
&.relative {
12-
position: relative !important;
13-
}
14-
left: 0 !important;
15-
width: auto !important;
16-
height: auto !important;
17-
overflow: auto !important;
18-
color: rgba(0,0,0,0) !important;
19-
background: rgba(0,0,0,0) !important;
20-
font-size: 1px !important;
21-
padding: 0 !important;
22-
margin: 0 !important;
23-
line-height: normal !important;
24-
z-index: 1;
6+
// Use to hide content visually while keeping it accessible to assistive technologies
7+
.visually-hidden {
8+
display: block;
9+
position: absolute !important;
10+
width: 1px !important;
11+
height: 1px !important;
12+
padding: 0 !important;
13+
margin: -1px !important;
14+
overflow: hidden !important;
15+
clip: rect(0, 0, 0, 0) !important;
16+
white-space: nowrap !important;
17+
border: 0 !important;
2518
}
2619

27-
// Force aria-labels to hide on hidden
28-
// --------------------------------------------------
29-
.aria-label.aria-hidden {
30-
display: none !important;
31-
}
20+
.aria-label {
21+
.visually-hidden();
22+
pointer-events: none;
23+
}
24+
25+
// Use to only display content when it's focused
26+
.aria-label-focusable, .visually-hidden-focusable {
27+
&:not(:focus):not(:focus-within) {
28+
.visually-hidden;
29+
}
30+
}
31+
32+
// jquery.a11y start
3233

3334
// Hidden focus guard
3435
// --------------------------------------------------

0 commit comments

Comments
 (0)