Skip to content

Commit f491551

Browse files
Add rule doc.
1 parent 028b86d commit f491551

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# menu-button-needs-labelling
2+
3+
MenuButton components must have accessible labelling for screen readers.
4+
5+
## Rule Details
6+
7+
This rule enforces that MenuButton components have proper accessible names through aria-label, aria-labelledby, or text content.
8+
9+
### Noncompliant
10+
11+
```jsx
12+
<MenuButton />
13+
```
14+
15+
### Compliant
16+
17+
```jsx
18+
<MenuButton aria-label="Menu options" />
19+
20+
<MenuButton aria-labelledby="menu-label">
21+
<span id="menu-label">Options</span>
22+
</MenuButton>
23+
24+
<MenuButton>Options</MenuButton>
25+
```
26+
27+
## When Not To Use
28+
29+
This rule should always be used for MenuButton components as they are interactive elements.
30+
31+
## Accessibility guidelines
32+
33+
- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# split-button-needs-labelling
2+
3+
SplitButton components must have accessible labelling for screen readers.
4+
5+
## Rule Details
6+
7+
This rule enforces that SplitButton components have proper accessible names through aria-label, aria-labelledby, or text content.
8+
9+
### Noncompliant
10+
11+
```jsx
12+
<SplitButton />
13+
```
14+
15+
### Compliant
16+
17+
```jsx
18+
<SplitButton aria-label="Save options" />
19+
20+
<SplitButton aria-labelledby="save-label">
21+
<span id="save-label">Save</span>
22+
</SplitButton>
23+
24+
<SplitButton>Save</SplitButton>
25+
```
26+
27+
## When Not To Use
28+
29+
This rule should always be used for SplitButton components as they are interactive elements.
30+
31+
## Accessibility guidelines
32+
33+
- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# card-needs-accessible-name
2+
3+
Interactive Card components must have an accessible name for screen readers.
4+
5+
## Rule Details
6+
7+
This rule enforces that Card components have proper accessible names when they are interactive (clickable).
8+
9+
### Noncompliant
10+
11+
```jsx
12+
<Card>
13+
<CardHeader>
14+
<Text weight="semibold">Card title</Text>
15+
</CardHeader>
16+
</Card>
17+
```
18+
19+
### Compliant
20+
21+
```jsx
22+
<Card aria-label="Product details">
23+
<CardHeader>
24+
<Text weight="semibold">Card title</Text>
25+
</CardHeader>
26+
</Card>
27+
28+
<Card aria-labelledby="card-title">
29+
<CardHeader>
30+
<Text id="card-title" weight="semibold">Card title</Text>
31+
</CardHeader>
32+
</Card>
33+
```
34+
35+
## When Not To Use
36+
37+
If the Card is purely decorative and not interactive, this rule is not necessary.
38+
39+
## Accessibility guidelines
40+
41+
- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# infolabel-needs-labelling
2+
3+
InfoLabel components must have accessible labelling for screen readers.
4+
5+
## Rule Details
6+
7+
This rule enforces that InfoLabel components have proper accessible names through aria-label, aria-labelledby, or text content.
8+
9+
### Noncompliant
10+
11+
```jsx
12+
<InfoLabel />
13+
```
14+
15+
### Compliant
16+
17+
```jsx
18+
<InfoLabel aria-label="Additional information" />
19+
20+
<InfoLabel aria-labelledby="info-text">
21+
<span id="info-text">Help text</span>
22+
</InfoLabel>
23+
24+
<InfoLabel>Help information</InfoLabel>
25+
```
26+
27+
## When Not To Use
28+
29+
If the InfoLabel is purely decorative, this rule may not be necessary.
30+
31+
## Accessibility guidelines
32+
33+
- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html)

0 commit comments

Comments
 (0)