Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus skip link on navigation #21108

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class RouteAnnouncer extends React.Component {
whiteSpace: `nowrap`,
border: 0,
}}
aria-live="assertive"
aria-live="polite"
aria-atomic="true"
ref={this.announcementRef}
></div>
Expand Down
8 changes: 8 additions & 0 deletions www/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exports.onRouteUpdate = ({ location, prevLocation }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

location is unused. I wonder why linting is not complaining about this...

if (prevLocation !== null) {
const skipLink = document.querySelector("[data-reach-skip-link]")
if (skipLink) {
skipLink.focus()
}
}
}