Skip to content

Commit c6a8b32

Browse files
committed
form-control-has-label docs
1 parent 69a1e4c commit c6a8b32

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/rules/form-control-has-label.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# form-control-has-label
2+
3+
Each form element must have a programmatically associated label element. You can do so by using an implicit `<label>`, explicit `<label>`, `aria-label` or `aria-labelledby`.
4+
5+
_References:_
6+
7+
1. [AXE](https://dequeuniversity.com/rules/axe/2.1/label)
8+
9+
## Rule details
10+
11+
### Succeed
12+
13+
```
14+
<label><input type="text" /></label>
15+
<input aria-label="test" type="text" />
16+
<input aria-labelledby="#id" type="text" />
17+
<label for="id"></label><input aria-labelledby="#id" id="id" />
18+
<input type="image" />
19+
```
20+
21+
### Fail
22+
23+
```
24+
<input value="1" type="text" />
25+
<textarea value="1"></textarea>
26+
```

0 commit comments

Comments
 (0)