Skip to content

Commit

Permalink
[docs] Add a11y label to nav landmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 29, 2019
1 parent 5dbc729 commit 540d75c
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppTableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function AppTableOfContents(props) {
);

return (
<nav className={classes.root}>
<nav className={classes.root} aria-label="Page table of contents">
{itemsServer.length > 0 ? (
<React.Fragment>
<Typography gutterBottom className={classes.contents}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/RouterBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class RouterBreadcrumbs extends React.Component {
);
}}
</Route>
<nav className={classes.lists}>
<nav className={classes.lists} aria-label="Mailbox folders">
<List>
<ListItemLink to="/inbox" open={this.state.open} onClick={this.handleClick} />
<Collapse component="li" in={this.state.open} timeout="auto" unmountOnExit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class RouterBreadcrumbs extends React.Component<RouterBreadcrumbsProp, RouterBre
);
}}
</Route>
<nav className={classes.lists}>
<nav className={classes.lists} aria-label="Mailbox folders">
<List>
<ListItemLink to="/inbox" open={this.state.open} onClick={this.handleClick} />
<Collapse component="li" in={this.state.open} timeout="auto" unmountOnExit>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/dividers/ListDividers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function ListDividers() {
const classes = useStyles();

return (
<List component="nav" className={classes.root}>
<List component="nav" className={classes.root} aria-label="Mailbox folders">
<ListItem button>
<ListItemText primary="Inbox" />
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/dividers/ListDividers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function ListDividers() {
const classes = useStyles();

return (
<List component="nav" className={classes.root}>
<List component="nav" className={classes.root} aria-label="Mailbox folders">
<ListItem button>
<ListItemText primary="Inbox" />
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/drawers/ResponsiveDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function ResponsiveDrawer(props) {
</Typography>
</Toolbar>
</AppBar>
<nav className={classes.drawer}>
<nav className={classes.drawer} aria-label="Mailbox folders">
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
<Hidden smUp implementation="css">
<Drawer
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/drawers/ResponsiveDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function ResponsiveDrawer(props: ResponsiveDrawerProps) {
</Typography>
</Toolbar>
</AppBar>
<nav className={classes.drawer}>
<nav className={classes.drawer} aria-label="Mailbox folders">
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
<Hidden smUp implementation="css">
<Drawer
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/lists/InsetList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function InsetList() {
const classes = useStyles();

return (
<List component="nav" className={classes.root}>
<List component="nav" className={classes.root} aria-label="Contacts">
<ListItem button>
<ListItemIcon>
<StarIcon />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/lists/InsetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function InsetList() {
const classes = useStyles();

return (
<List component="nav" className={classes.root}>
<List component="nav" className={classes.root} aria-label="Contacts">
<ListItem button>
<ListItemIcon>
<StarIcon />
Expand Down
7 changes: 6 additions & 1 deletion docs/src/pages/components/lists/NestedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ function NestedList() {
return (
<List
component="nav"
subheader={<ListSubheader component="div">Nested List Items</ListSubheader>}
aria-labelledby="nested-list-subheader"
subheader={
<ListSubheader component="div" id="nested-list-subheader">
Nested List Items
</ListSubheader>
}
className={classes.root}
>
<ListItem button>
Expand Down
7 changes: 6 additions & 1 deletion docs/src/pages/components/lists/NestedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ function NestedList() {
return (
<List
component="nav"
subheader={<ListSubheader component="div">Nested List Items</ListSubheader>}
aria-labelledby="nested-list-subheader"
subheader={
<ListSubheader component="div" id="nested-list-subheader">
Nested List Items
</ListSubheader>
}
className={classes.root}
>
<ListItem button>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/lists/SelectedListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function SelectedListItem() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Main mailbox folders">
<ListItem
button
selected={selectedIndex === 0}
Expand All @@ -49,7 +49,7 @@ function SelectedListItem() {
</ListItem>
</List>
<Divider />
<List component="nav">
<List component="nav" aria-label="Secondary mailbox folder">
<ListItem
button
selected={selectedIndex === 2}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/lists/SelectedListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function SelectedListItem() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Main mailbox folders">
<ListItem
button
selected={selectedIndex === 0}
Expand All @@ -52,7 +52,7 @@ function SelectedListItem() {
</ListItem>
</List>
<Divider />
<List component="nav">
<List component="nav" aria-label="Secondary mailbox folder">
<ListItem
button
selected={selectedIndex === 2}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/lists/SimpleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function SimpleList() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Main mailbox folders">
<ListItem button>
<ListItemIcon>
<InboxIcon />
Expand All @@ -40,7 +40,7 @@ function SimpleList() {
</ListItem>
</List>
<Divider />
<List component="nav">
<List component="nav" aria-label="Secondary mailbox folders">
<ListItem button>
<ListItemText primary="Trash" />
</ListItem>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/lists/SimpleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function SimpleList() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Main mailbox folders">
<ListItem button>
<ListItemIcon>
<InboxIcon />
Expand All @@ -42,7 +42,7 @@ function SimpleList() {
</ListItem>
</List>
<Divider />
<List component="nav">
<List component="nav" aria-label="Secondary mailbox folders">
<ListItem button>
<ListItemText primary="Trash" />
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/menus/SimpleListMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function SimpleListMenu() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Device settings">
<ListItem
button
aria-haspopup="true"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/menus/SimpleListMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function SimpleListMenu() {

return (
<div className={classes.root}>
<List component="nav">
<List component="nav" aria-label="Device settings">
<ListItem
button
aria-haspopup="true"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/guides/composition/ComponentProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ function ComponentProperty(props) {
)}
</Route>
<div className={classes.lists}>
<List component="nav">
<List component="nav" aria-label="Main mailbox folders">
<ListItemLink to="/inbox" primary="Inbox" icon={<InboxIcon />} />
<ListItemLink to="/drafts" primary="Drafts" icon={<DraftsIcon />} />
</List>
<Divider />
<List component="nav">
<List component="nav" aria-label="Secondary mailbox folders">
<ListItemLinkShorthand to="/trash" primary="Trash" />
<ListItemLinkShorthand to="/spam" primary="Spam" />
</List>
Expand Down

0 comments on commit 540d75c

Please sign in to comment.