Skip to content

Conversation

geoffrich
Copy link
Member

@geoffrich geoffrich commented Dec 23, 2021

This PR adds a skip link to svelte.dev and kit.svelte.dev. This allows users navigating by keyboard or with a screen reader to bypass the main navigation, which they would otherwise need to tab through on every page load. It is hidden until it receives focus with the keyboard, at which point it becomes visible.

Points of note:

  • I had to set rel="external" on the skip link. Not doing so made it not work the first time and reset focus to the top of the page, not the main content. Not sure if this is expected or a bug in SvelteKit This was a bug, and is no longer needed since latest SvelteKit fixes it
  • The skip link needed a z-index set so that it appeared over the main nav.

Screenshot of how it appears when focused:

Screenshot of how the skip link appears when focused

@vercel
Copy link

vercel bot commented Dec 23, 2021

@geoffrich is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@benmccann
Copy link
Member

Hmm, you shouldn't need rel=external. The behavior you described does sound like a bug

@bluwy
Copy link
Member

bluwy commented Dec 24, 2021

There's also coincidentally a discussion earlier about the bug as well that might be related.

@vercel
Copy link

vercel bot commented Jan 27, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

hn – ./sites/hn.svelte.dev

🔍 Inspect: https://vercel.com/svelte/hn/5HdwuEPW9Cdk4FiQhwYNCnbbEvTH
✅ Preview: https://hn-git-fork-geoffrich-skip-link-svelte.vercel.app

svelte-dev – ./sites/svelte.dev

🔍 Inspect: https://vercel.com/svelte/svelte-dev/5wFy1Su2U2iwpFMKifeHyroccw2K
✅ Preview: https://svelte-dev-git-fork-geoffrich-skip-link-svelte.vercel.app

@geoffrich
Copy link
Member Author

This is ready for review now. I was able to remove rel="external" from the skip link after the SvelteKit issue was fixed.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Works fine for me

@geoffrich geoffrich merged commit 36b7986 into sveltejs:master Jan 28, 2022
@geoffrich geoffrich deleted the skip-link branch January 28, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants