Skip to content

Commit 4c12181

Browse files
Add rule docs.
1 parent f491551 commit 4c12181

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-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)

0 commit comments

Comments
 (0)