Skip to content

Commit 7f5d2ca

Browse files
pavlov-kirillShivangi Mittal
andauthored
Added role for sidebar-nav (npm#286)
* added role for sidebar-nav * fix role for third level Co-authored-by: Shivangi Mittal <shmittal@Shivangis-MacBook-Pro.local>
1 parent 5f29f95 commit 7f5d2ca

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

theme/src/components/nav-items.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ function topLevelItems(items, path) {
105105
borderTopWidth={1}
106106
py={3}
107107
px={4}
108+
role="listitem"
108109
>
109110
<Flex flexDirection="column">
110111
<TopLevelLink to={item.url} key={item.title}>{item.title}</TopLevelLink>
@@ -123,11 +124,11 @@ function secondLevelItems(items, path) {
123124
}
124125

125126
return (
126-
<Flex flexDirection="column" mt={2}>
127+
<Flex flexDirection="column" mt={2} role="list">
127128
{items.map((item) => {
128129
const children = NavHierarchy.isActiveUrl(path, item.url) ? NavHierarchy.getHierarchy(item, { path: path, hideVariants: true }) : null;
129130
return(
130-
<Box key={item.title}>
131+
<Box key={item.title} role="listitem">
131132
<SecondLevelLink key={item.url} to={item.url}>
132133
{item.title}
133134
{item.description != null ? (
@@ -150,11 +151,13 @@ function thirdLevelItems(items, path) {
150151
}
151152

152153
return (
153-
<Flex flexDirection="column" mt={2}>
154+
<Flex flexDirection="column" mt={2} role="list">
154155
{items.map((item) => (
155-
<ThirdLevelLink key={item.url} to={item.url}>
156-
{item.title}
157-
</ThirdLevelLink>
156+
<Box key={item.title} role="listitem">
157+
<ThirdLevelLink key={item.url} to={item.url}>
158+
{item.title}
159+
</ThirdLevelLink>
160+
</Box>
158161
))}
159162
</Flex>
160163
)

theme/src/components/sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Sidebar({location, editOnGitHub}) {
2222
height="100%"
2323
style={{overflow: 'auto'}}
2424
>
25-
<Flex flexDirection="column">
25+
<Flex flexDirection="column" role="list">
2626
<NavItems location={location} items={navItems} editOnGitHub={editOnGitHub} />
2727
</Flex>
2828
</BorderBox>

0 commit comments

Comments
 (0)