Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 0e8bcff

Browse files
committed
fix(component-nav): apply aria-label to navs
- so that they can be differentiated by screen readers Relates to #671.
1 parent 94216e3 commit 0e8bcff

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="docs-component-viewer-nav">
22
<div class="docs-component-viewer-nav-content">
3-
<nav *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;">
3+
<div *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;">
44
<button cdkAccordionItem #panel="cdkAccordionItem" (click)="panel.toggle()" expanded="true"
55
class="docs-nav-content-btn"
66
[attr.aria-label]="category.name + ', section toggle'"
@@ -9,7 +9,8 @@
99
{{category.name}}
1010
<mat-icon>{{panel.expanded ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}}</mat-icon>
1111
</button>
12-
<mat-nav-list dense [@bodyExpansion]="panel.expanded ? 'expanded' : 'collapsed'" id="panel-{{category.id}}">
12+
<mat-nav-list dense [@bodyExpansion]="panel.expanded ? 'expanded' : 'collapsed'"
13+
id="panel-{{category.id}}" [attr.aria-label]="category.name">
1314
<a mat-list-item *ngFor="let component of category.items"
1415
[routerLink]="'/' + (params | async)?.section+ '/' + component.id"
1516
routerLinkActive="docs-component-viewer-sidenav-item-selected"
@@ -18,6 +19,6 @@
1819
</a>
1920
</mat-nav-list>
2021
<hr *ngIf="!last" />
21-
</nav>
22+
</div>
2223
</div>
2324
</div>

src/app/pages/component-viewer/component-viewer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="docs-component-viewer">
2-
<nav mat-tab-nav-bar class="docs-component-viewer-tabbed-content">
2+
<nav mat-tab-nav-bar class="docs-component-viewer-tabbed-content" aria-label="Section">
33
<a mat-tab-link class="docs-component-viewer-section-tab"
44
*ngFor="let section of sections"
55
[routerLink]="section.toLowerCase()"

src/app/shared/navbar/navbar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- TODO: figure out if the <nav> should go inside of a <header> element. -->
2-
<nav class="docs-navbar-header"
2+
<nav class="docs-navbar-header" aria-label="Top Toolbar"
33
[class.is-next-version]="isNextVersion">
44
<a mat-button class="docs-button" routerLink="/" aria-label="Angular Material">
55
<img class="docs-angular-logo"
@@ -28,7 +28,7 @@
2828
alt="angular">
2929
</a>
3030
</nav>
31-
<nav class="docs-navbar docs-navbar-show-small">
31+
<nav class="docs-navbar docs-navbar-show-small" aria-label="Section Nav Bar">
3232
<a mat-button class="docs-navbar-link"
3333
*ngFor="let key of sectionKeys"
3434
[routerLink]="key">{{sections[key].name}}</a>

src/app/shared/table-of-contents/table-of-contents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div *ngFor="let linkSection of _linkSections" class="docs-toc-container">
22
<div class="docs-toc-heading">{{linkSection.name}}</div>
3-
<nav>
3+
<nav aria-label="Section Table of Contents">
44
<a [href]="_rootUrl + '#' + link.id"
55
*ngFor="let link of linkSection.links; let i = index"
66
class="docs-level-{{link.type}} docs-link"

0 commit comments

Comments
 (0)