Skip to content

Commit

Permalink
fix: skip link, contain all content by landmarks (#3646)
Browse files Browse the repository at this point in the history
* fix: landmarks, skip links a11y violations

* fix list a11y violations

* add aria-label to controller & device checkboxes

* fix landmarks

* use aside element for StatusBar
  • Loading branch information
petermakowski committed Feb 28, 2022
1 parent 2d99bb1 commit 5cfc7dd
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 15 deletions.
10 changes: 4 additions & 6 deletions shared/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export const Header = ({
"u-hide--hardware-menu-threshold": link.inHardwareMenu,
})}
key={link.url}
role="presentation"
>
{generateLink(link, {
"aria-current": isSelected(path, link, appendNewBase)
Expand All @@ -240,7 +239,6 @@ export const Header = ({
"p-navigation__link p-subnav is-dark hardware-menu",
{ "is-active": hardwareMenuOpen }
)}
role="presentation"
>
{/* eslint-disable-next-line */}
<a
Expand Down Expand Up @@ -293,7 +291,7 @@ export const Header = ({
)}
</li>
)}
<li className="p-navigation__link" role="presentation">
<li className="p-navigation__link">
{/* eslint-disable-next-line */}
<a
href="#"
Expand All @@ -318,9 +316,9 @@ export const Header = ({

return (
<>
<span className="u-off-screen">
<a href="#main-content">Skip to main content</a>
</span>
<a href="#main-content" className="p-link--skip">
Skip to main content
</a>
<header id="navigation" className="p-navigation is-dark">
<div className="p-navigation__row row">
<div className="p-navigation__banner">
Expand Down
4 changes: 2 additions & 2 deletions shared/src/components/StatusBar/StatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const StatusBar = ({
version,
}: Props): JSX.Element => {
return (
<div className="p-status-bar">
<aside className="p-status-bar" aria-label="status bar">
<div className="row">
<div className="col-6">
<strong data-testid="status-bar-maas-name">{maasName} MAAS</strong>:{" "}
Expand All @@ -25,7 +25,7 @@ export const StatusBar = ({
</div>
)}
</div>
</div>
</aside>
);
};

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const App = (): JSX.Element => {
uuid={uuid as string}
version={version}
/>
{content}
<main id="main-content">{content}</main>
{version && (
<Footer
debug={debug}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/base/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Login = (): JSX.Element => {
}, [dispatch, externalAuthURL]);

return (
<Strip element="main">
<Strip>
<Row>
<Col size={6} emptyLarge={4}>
{externalAuthURL && error && (
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/base/components/Section/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Section = ({
</div>
) : null}
<Strip
element="main"
element="section"
includeCol={false}
rowClassName="section__content-wrapper"
shallow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Section renders 1`] = `
</Row>
</div>
<Strip
element="main"
element="section"
includeCol={false}
rowClassName="section__content-wrapper"
shallow={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const ControllerListTable = ({
content: (
<div className="u-flex">
<GroupCheckbox
aria-label="all controllers"
data-testid="all-controllers-checkbox"
handleGroupCheckbox={handleGroupCheckbox}
items={controllerIDs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const DeviceListTable = ({
content: (
<div className="u-flex">
<GroupCheckbox
aria-label="all devices"
data-testid="all-devices-checkbox"
handleGroupCheckbox={handleGroupCheckbox}
items={deviceIDs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ exports[`IncompleteCard renders 1`] = `
className="section"
>
<Strip
element="main"
element="section"
includeCol={false}
rowClassName="section__content-wrapper"
shallow={true}
>
<main
<section
className="p-strip is-shallow"
>
<Row
Expand Down Expand Up @@ -137,7 +137,7 @@ exports[`IncompleteCard renders 1`] = `
</Col>
</div>
</Row>
</main>
</section>
</Strip>
</div>
</Section>
Expand Down
7 changes: 7 additions & 0 deletions ui/src/scss/_patterns_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@
color: $color-dark;
}
}

// Make skip link work with the custom MAAS layout
.p-link--skip:focus {
position: absolute;
background-color: $color-x-light;
padding: $sph-inner;
}
}

0 comments on commit 5cfc7dd

Please sign in to comment.