Skip to content

Commit 33aed06

Browse files
add docs
1 parent ab3e1c9 commit 33aed06

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# No visually hidden interactive elements
2+
3+
## Rule Details
4+
5+
This rule guards against visually hiding interactive elements. If a sighted keyboard user navigates to an interactive element that is visually hidden they might become confused and assume that keyboard focus has been lost.
6+
7+
Note: we are not guarding against visually hidden `input` elements at this time. Some visually hidden inputs might cause a false positive (e.g. some file inputs).
8+
9+
### Why do we visually hide content?
10+
11+
Visually hiding content can be useful when you want to provide information specifically to screen reader users or other assistive technology users while keeping content hidden from sighted users.
12+
13+
Applying the following css will visually hide content while still making it accessible to screen reader users.
14+
15+
```css
16+
clip-path: inset(50%);
17+
height: 1px;
18+
overflow: hidden;
19+
position: absolute;
20+
white-space: nowrap;
21+
width: 1px;
22+
```
23+
24+
👎 Examples of **incorrect** code for this rule:
25+
26+
```jsx
27+
<h2 className="sr-only">Welcome to GitHub</h2>
28+
```
29+
30+
👍 Examples of **correct** code for this rule:
31+
32+
```jsx
33+
<h2 className="sr-only">Welcome to GitHub</h2>
34+
```
35+
36+
## Version

0 commit comments

Comments
 (0)