Skip to content

Commit 6375b91

Browse files
authored
Update navigation-has-label.md
1 parent 6d1e7a4 commit 6375b91

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

docs/rules/accessibility/navigation-has-label.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## Rule Details
44

5-
This rule enforces that a navigation landmark (a `<nav>` or a `role="navigation"`) has an accessible name. This rule is helpful to enforce for sites (like GitHub) where multiple navigation is common.
5+
This rule enforces that a navigation landmark (a `<nav>` or a `role="navigation"`) has an accessible name. This rule is helpful for sites (like GitHub) where multiple navigation is common.
66

7-
The navigation landmark element should have an `aria-label` attribute, or `aria-labelledby` to distinguish it from other elements.
7+
An accessible name ensures that one can distinguish between multiple navigation elements.
8+
9+
If the navigation area begins with a heading, use the heading to label the navigation element using the `aria-labelledby` attribute. If there is no heading, then you may set `aria-label`. Make sure to format the text the same way you should visual text (Related: [aria-label is well formatted](./aria-label-is-well-formatted.md)).
810

911
## Resources
1012

@@ -24,7 +26,15 @@ The navigation landmark element should have an `aria-label` attribute, or `aria-
2426

2527
```erb
2628
<!-- correct -->
27-
<nav aria-labelledby="title_id"t>
28-
<h1 id="title_id">This is a text</h1>
29+
<nav aria-labelledby="title_id">
30+
<h1 id="title_id">Setings</h1>
31+
...
32+
</nav>
33+
```
34+
35+
```erb
36+
<!-- correct -->
37+
<nav aria-label="Repos">
38+
...
2939
</nav>
3040
```

0 commit comments

Comments
 (0)