Skip to content

Commit 9ef80f4

Browse files
docs(user.guide): add input-requires-label (#548)
Relates to #159 Signed-off-by: Antoine Leblanc <[email protected]> Co-authored-by: David Dias <[email protected]>
1 parent 3a7600a commit 9ef80f4

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

docs/user-guide/list-rules.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ title: List of rules
2222
- [`attr-value-double-quotes`](/docs/user-guide/rules/attr-value-double-quotes): Attribute values must be in double quotes.
2323
- [`attr-value-not-empty`](/docs/user-guide/rules/attr-not-empty): All attributes must have values.
2424
- [`alt-require`](/docs/user-guide/rules/alt-require): The alt attribute of an element must be present and alt attribute of area[href] and input[type=image] must have a value.
25+
- [`input-requires-label`](/docs/user-guide/rules/input-requires-label): All [ input ] tags must have a corresponding [ label ] tag.
2526

2627
### Tags
2728

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: input-requires-label
3+
title: input-requires-label
4+
keywords:
5+
- input
6+
- label
7+
- accessiblity
8+
---
9+
10+
All [ input ] tags must have a corresponding [ label ] tag.
11+
12+
Level: warning
13+
14+
## Config value
15+
16+
1. true: enable rule
17+
2. false: disable rule
18+
19+
The following pattern are **not** considered violations:
20+
21+
<!-- prettier-ignore -->
22+
```html
23+
<input type="password">
24+
<input id="some-id" type="password" /> <label for="some-other-id"/>
25+
<input id="some-id" type="password" /> <label for=""/>
26+
<input type="password" /> <label for="something"/>
27+
```
28+
29+
The following pattern is considered violation:
30+
31+
<!-- prettier-ignore -->
32+
```html
33+
<label for="some-id"/><input id="some-id" type="password" />
34+
<input id="some-id" type="password" /> <label for="some-id"/>
35+
```

0 commit comments

Comments
 (0)