Skip to content

Commit

Permalink
feat(project): add sidebar aria labels
Browse files Browse the repository at this point in the history
  • Loading branch information
RCVZ committed Apr 30, 2021
1 parent df53f63 commit d8963e2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
17 changes: 13 additions & 4 deletions src/components/Layout/__snapshots__/Layout.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ exports[`<Layout /> renders layout 1`] = `
class="container"
>
<div
aria-label="open menu"
class="menu"
role="button"
>
<svg
aria-hidden="true"
class="icon"
focusable="false"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -38,6 +42,7 @@ exports[`<Layout /> renders layout 1`] = `
/>
</div>
<nav
aria-label="menu"
class="nav"
>
<a
Expand Down Expand Up @@ -77,11 +82,15 @@ exports[`<Layout /> renders layout 1`] = `
<div
class="sidebar"
>
<nav
<div
aria-label="close menu"
class="group"
role="button"
>
<svg
aria-hidden="true"
class="icon"
focusable="false"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -95,8 +104,8 @@ exports[`<Layout /> renders layout 1`] = `
/>
</g>
</svg>
</nav>
<div
</div>
<nav
class="group"
>
<a
Expand Down Expand Up @@ -129,7 +138,7 @@ exports[`<Layout /> renders layout 1`] = `
Settings
</span>
</a>
</div>
</nav>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const SideBar: React.FC<SideBarProps> = ({ sideBarOpen, closeSideBar }) => {
})}
onClick={closeSideBar}
>
<nav className={styles.group}>
<div className={styles.group} aria-label="close menu" role="button">
<Close />
</nav>
<div className={styles.group}>
</div>
<nav className={styles.group}>
<ButtonLink label="Home" to="/" />
<ButtonLink label="Test" to="/" />
<hr className={styles.divider} />
<ButtonLink label="Settings" to="/" />
</div>
</nav>
</div>
</Fragment>
);
Expand Down
12 changes: 8 additions & 4 deletions src/components/SideBar/__snapshots__/SideBar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ exports[`<SideBar /> renders sideBar 1`] = `
<div
class="sidebar open"
>
<nav
<div
aria-label="close menu"
class="group"
role="button"
>
<svg
aria-hidden="true"
class="icon"
focusable="false"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -26,8 +30,8 @@ exports[`<SideBar /> renders sideBar 1`] = `
/>
</g>
</svg>
</nav>
<div
</div>
<nav
class="group"
>
<a
Expand Down Expand Up @@ -60,7 +64,7 @@ exports[`<SideBar /> renders sideBar 1`] = `
Settings
</span>
</a>
</div>
</nav>
</div>
</div>
`;
2 changes: 2 additions & 0 deletions src/icons/createIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default (viewBox: string, icon: JSX.Element) => ({
className={classNames(styles.icon, className)}
viewBox={viewBox}
{...props}
focusable="false"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
{icon}
Expand Down

0 comments on commit d8963e2

Please sign in to comment.