Skip to content

Commit a777b9d

Browse files
authored
Merge pull request #113 from isaacphysics/feature/skip-to-content
Adds skip to content for keyboard users
2 parents a9a66f5 + 0e7f055 commit a777b9d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/app/components/navigation/Header.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const HeaderComponent = ({user}: HeaderProps) => {
2727
</Link>
2828
</div>
2929

30+
<a href="#main" className="skip-main">Skip to main content</a>
31+
3032
<div className="header-links ml-auto pr-3 px-md-3 d-flex align-items-center d-print-none">
3133
{user &&
3234
(!user.loggedIn ?

src/app/components/navigation/IsaacApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const IsaacApp = () => {
7878
<ActiveModal />
7979
<CookieBanner />
8080
<EmailVerificationBanner />
81-
<main role="main" className="flex-fill content-body">
81+
<main id="main" role="main" className="flex-fill content-body">
8282
<Switch>
8383
{/* Errors; these paths work but aren't really used */}
8484
<Route exact path={serverError ? undefined : "/error"} component={ServerError} />

src/scss/header.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,30 @@ header {
6969
line-height: 1.2;
7070
}
7171

72+
a.skip-main {
73+
left:-999px;
74+
position:absolute;
75+
top:auto;
76+
width:1px;
77+
height:1px;
78+
overflow:hidden;
79+
z-index:-999;
80+
}
81+
a.skip-main:focus, a.skip-main:active {
82+
color: #000;
83+
background-color:#fff;
84+
left: 5%;
85+
top: 60px;
86+
width: 175px;
87+
height: auto;
88+
overflow: auto;
89+
margin: 10px;
90+
text-align:center;
91+
font-family: $secondary-font-medium;
92+
font-size: 1rem;
93+
z-index:999;
94+
}
95+
7296
// NOMENSA header.scss
7397
// !important used to override bootstraps use of !important :(
7498

0 commit comments

Comments
 (0)