Skip to content

Commit

Permalink
Accessibility - Skip to main content link (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrose78 authored Apr 11, 2022
1 parent 023a628 commit 176fe63
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ out
/out_functions/

build/*

20 changes: 20 additions & 0 deletions src/assets/css/nav.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
/* NAV */
/* overide bootstrap mobile nav styles */

/* skip to main link - Accessibility */

#skip-to-main-link {
display: block;
font-size: 1.3rem;
left: 250px;
background-color: var(--element-2);
padding: 5px 5px;
color: var(--element-4);
text-decoration: underline;
position: absolute;
transform: translateY(-450%);
z-index: 99;
}

#skip-to-main-link:focus {
transform: translateY(-200%);
}

/* hamburger menu styles */
.hamburger {
position: absolute;
Expand Down
5 changes: 5 additions & 0 deletions src/components/Nav/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ function Nav() {
<div className="homeLink">VetsWhoCode</div>
</a>
</Link>
<Link href="#our_stories">
<a id="skip-to-main-link" className="a">
Skip to main
</a>
</Link>
</div>
<button
type="button"
Expand Down
7 changes: 7 additions & 0 deletions tests/components/__snapshots__/Layout.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ exports[`<Layout /> should render correctly 1`] = `
VetsWhoCode
</div>
</a>
<a
class="a"
href="/#our_stories"
id="skip-to-main-link"
>
Skip to main
</a>
</div>
<button
aria-expanded="false"
Expand Down
7 changes: 7 additions & 0 deletions tests/components/__snapshots__/Nav.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ exports[`<Nav /> should render correctly 1`] = `
VetsWhoCode
</div>
</a>
<a
class="a"
href="/#our_stories"
id="skip-to-main-link"
>
Skip to main
</a>
</div>
<button
aria-expanded="false"
Expand Down

1 comment on commit 176fe63

@vercel
Copy link

@vercel vercel bot commented on 176fe63 Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.