feat: add skip to content link for keyboard-first visitors #347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reattempts #212 and adds a skip navigation link to the home and page templates.
AI summary
This pull request introduces a new accessibility feature, a "Skip to content" link, for improved navigation by keyboard-first users. It also includes related updates to the codebase, tests, and documentation. Below is a breakdown of the most important changes grouped by theme.
Accessibility Feature: "Skip to Content" Link
SkipNavLink
andSkipNavContent
components from the@reach/skip-nav
library to theLayout
andHomeTemplate
components, enabling users to skip directly to the main content. (theme/src/components/layout.js
,theme/src/templates/home.js
) [1] [2] [3] [4] [5]@reach/skip-nav/styles.css
ingatsby-browser.js
. (theme/gatsby-browser.js
)Navigation Behavior Enhancements
onRouteUpdate
function to focus the main content (SkipNavContent
) after a route change, improving accessibility for keyboard users. (theme/gatsby-browser.js
)Testing
shouldUpdateScroll
andonRouteUpdate
functions, including mock implementations for DOM manipulation. (theme/gatsby-browser.spec.js
)Documentation and Versioning
CHANGELOG.md
to document the new feature in version0.45.0
. (CHANGELOG.md
)package.json
version to0.45.0
and added@reach/skip-nav
as a dependency. (theme/package.json
) [1] [2]Snapshot Updates
SkipNavContent
element. (theme/src/components/__snapshots__/layout.spec.js.snap
) [1] [2] [3]