You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _rules/aria-hidden-no-focusable-content-6cfa84.md
+28-24Lines changed: 28 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
id: 6cfa84
3
-
name: Element with aria-hidden has no focusable content
3
+
name: Element with aria-hidden has no content in sequential focus navigation
4
4
rule_type: atomic
5
5
description: |
6
-
This rule checks that elements with an `aria-hidden` attribute do not contain focusable elements.
6
+
This rule checks that elements with an `aria-hidden` attribute do not contain elements that are part of the sequential focus navigation and focusable.
7
7
accessibility_requirements:
8
8
wcag20:4.1.2: # Name, Role, Value (A)
9
9
forConformance: true
@@ -32,11 +32,11 @@ This rule applies to any element with an `aria-hidden` [attribute value][] of `t
32
32
33
33
## Expectation
34
34
35
-
None of the target elements are [focusable][], nor do they have [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant)in the [flat tree](https://drafts.csswg.org/css-scoping/#flat-tree) that are [focusable][].
35
+
None of the target elements has an [inclusive descendant][]in the [flat tree][] that are [focusable][] and part of the [sequential focus navigation][].
36
36
37
37
## Assumptions
38
38
39
-
Interacting with the page does not result in changing the `aria-hidden`[attribute value][] of target elements. An example of such a situation would be when closing a modal dialog makes previously hidden and not [focusable][]elements become [focusable][].
39
+
Interacting with the page does not result in changing the `aria-hidden`[attribute value][] of target elements. An example of such a situation would be when closing a modal dialog makes previously hidden elements that were not [focusable][]or part of the [sequential focus navigation][]become [focusable][] and part of the [sequential focus navigation][].
40
40
41
41
## Accessibility Support
42
42
@@ -48,7 +48,7 @@ Using `aria-hidden="false"` on a descendant of an element with `aria-hidden="tru
48
48
49
49
By adding `aria-hidden="true"` to an element, content authors ensure that assistive technologies will ignore the element. This can be used to hide parts of a web page that are [pure decoration](https://www.w3.org/TR/WCAG21/#dfn-pure-decoration), such as icon fonts - that are not meant to be read by assistive technologies.
50
50
51
-
A [focusable][]element with `aria-hidden="true"`is ignored as part of the reading order, but still part of the focus order, making its state of [visible](#visible) or hidden unclear.
51
+
An element with an `aria-hidden` attribute set to `true` that is also part of the [sequential focus navigation][] may cause confusion for users of assistive technologies because the element can be reached via [sequential focus navigation][], but it should be hidden and not [included in the accessibility tree][].
52
52
53
53
The 1 second time span introduced in the exception of the definition of [focusable][] is an arbitrary limit which is not included in WCAG. Given that scripts can manage the focus state of elements, testing the focused state of an element consistently would be impractical without a time limit.
54
54
@@ -71,15 +71,15 @@ The 1 second time span introduced in the exception of the definition of [focusab
71
71
72
72
#### Passed Example 1
73
73
74
-
This `p` element is not [focusable][].
74
+
This `p` element is not part of the [sequential focus navigation][].
75
75
76
76
```html
77
77
<paria-hidden="true">Some text</p>
78
78
```
79
79
80
80
#### Passed Example 2
81
81
82
-
This `a` element is not [focusable][] because it is hidden through CSS.
82
+
This `a` element is not part of the [sequential focus navigation][] because it is hidden through CSS.
83
83
84
84
```html
85
85
<divaria-hidden="true">
@@ -89,15 +89,15 @@ This `a` element is not [focusable][] because it is hidden through CSS.
89
89
90
90
#### Passed Example 3
91
91
92
-
This `input` element is not [focusable][] because of the `disabled` attribute.
92
+
This `input` element is not part of the [sequential focus navigation][] because of the `disabled` attribute.
93
93
94
94
```html
95
95
<inputdisabledaria-hidden="true" />
96
96
```
97
97
98
98
#### Passed Example 4
99
99
100
-
This `a` element is not [focusable][] because it moves focus to the `input` element whenever it receives focus.
100
+
This `a` element is part of the [sequential focus navigation][], but moves focus to the `input` element whenever it receives focus.
101
101
102
102
```html
103
103
<divaria-hidden="true">
@@ -106,11 +106,21 @@ This `a` element is not [focusable][] because it moves focus to the `input` elem
106
106
<input />
107
107
```
108
108
109
+
#### Passed Example 5
110
+
111
+
This `button` element is [focusable][], but not part of the [sequential focus navigation][] because of the `tabindex` attribute.
112
+
113
+
```html
114
+
<divaria-hidden="true">
115
+
<buttontabindex="-1">Some button</button>
116
+
</div>
117
+
```
118
+
109
119
### Failed
110
120
111
121
#### Failed Example 1
112
122
113
-
This `a` element positioned off screen is [focusable][] using the keyboard.
123
+
This `a` element positioned off screen is part of the [sequential focus navigation][] using the keyboard.
114
124
115
125
```html
116
126
<divaria-hidden="true">
@@ -120,7 +130,7 @@ This `a` element positioned off screen is [focusable][] using the keyboard.
120
130
121
131
#### Failed Example 2
122
132
123
-
This `input` element is [focusable][] because it was incorrectly disabled.
133
+
This `input` element is part of the [sequential focus navigation][] because it was incorrectly disabled.
124
134
125
135
```html
126
136
<divaria-hidden="true">
@@ -130,7 +140,7 @@ This `input` element is [focusable][] because it was incorrectly disabled.
130
140
131
141
#### Failed Example 3
132
142
133
-
This `button` element is [focusable][] and a descendant of an element with an `aria-hidden`[attribute value][] of `true` because `aria-hidden` can't be reset once set to true on an ancestor.
143
+
This `button` element is part of the [sequential focus navigation][] and a descendant of an element with an `aria-hidden`[attribute value][] of `true` because `aria-hidden` can't be reset once set to true on an ancestor.
134
144
135
145
```html
136
146
<divaria-hidden="true">
@@ -142,25 +152,15 @@ This `button` element is [focusable][] and a descendant of an element with an `a
142
152
143
153
#### Failed Example 4
144
154
145
-
This `p` element is [focusable][] because of the `tabindex` attribute.
155
+
This `p` element is part of the [sequential focus navigation][] because of the `tabindex` attribute.
146
156
147
157
```html
148
158
<ptabindex="0"aria-hidden="true">Some text</p>
149
159
```
150
160
151
161
#### Failed Example 5
152
162
153
-
This `button` element is [focusable][] because of the `tabindex` attribute.
154
-
155
-
```html
156
-
<divaria-hidden="true">
157
-
<buttontabindex="-1">Some button</button>
158
-
</div>
159
-
```
160
-
161
-
#### Failed Example 6
162
-
163
-
This `summary` element is [focusable][].
163
+
This `summary` element is part of the [sequential focus navigation][].
164
164
165
165
```html
166
166
<detailsaria-hidden="true">
@@ -198,4 +198,8 @@ This `aria-hidden` attribute has an incorrect value.
198
198
```
199
199
200
200
[attribute value]: #attribute-value'Definition of Attribute Value'
201
+
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree'Definition of flat tree'
201
202
[focusable]: #focusable'Definition of focusable'
203
+
[inclusive descendant]: https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant'DOM definition of Inclusive Descendant'
204
+
[included in the accessibility tree]: #included-in-the-accessibility-tree'Definition of Included in the Accessibility Tree'
0 commit comments