-
Notifications
You must be signed in to change notification settings - Fork 197
Add "Skip to main content" link and fix sticky header scroll offset #358
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
base: main
Are you sure you want to change the base?
Conversation
5829e11 to
84e304b
Compare
6e34bbc to
b14fee5
Compare
1203077 to
f3f3cb6
Compare
|
hi @joshjavier, please address the merge conflicts present in your pr - it looks good and we want to get this merged in! cheers |
This commit adds a "Skip to main content" link as the first interactive element on the page. The link is initially hidden but appears at the top-left corner of the page on focus. It's anchored to the main content area, allowing users to skip the header navigation when tabbing through the page. I also ensured that the site has a single `<main>` element for proper semantic structure. This implementation aligns with the Accessibility Statement and WCAG 2.1 guidelines.
This commit adds a dynamic `scroll-padding-top` to the `<html>` element based on the header height, so that when users activate the "Skip to the main content" link, the main content is fully visible and not hidden behind the sticky header. I created a custom `useResizeObserver` hook and placed it in the newly-created `src/hooks` directory to update the padding when the header height changes, e.g., when the user resizes the viewport.
054049b to
8b6eff9
Compare
Hi @mayspc, thanks for the heads-up! I've rebased my branch on top of the latest |
|
@joshjavier yahoo, I'm watching this PR now. Can you rebase your branch please. I'll check it once it is done! |
Changes made
<main>element for correct navigation.<main>element on the site for semantic correctness.scroll-padding-topon the<html>element (via a customuseResizeObserverhook) so that the sticky header no longer obscures content when using the skip link.Preview
recording.mp4
This PR closes #354.