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

Improve permalink a11y #32

Merged
merged 1 commit into from
Apr 24, 2021
Merged

Improve permalink a11y #32

merged 1 commit into from
Apr 24, 2021

Conversation

geoffrich
Copy link
Member

As instructed by @benmccann, moving sveltejs/site-kit#35 to the new sites repo.

The original intention behind this PR was to improve a11y and fix some Axe violations on svelte.dev related to permalinks. To do this, I needed to update some of the site-kit components. I've done so and applied the a11y fixes to kit.svelte.dev.

Summary of the changes:

  • Remove aria-hidden from permalinks. This fixes the Axe violation ARIA hidden element must not contain focusable elements
  • Add visually hidden text to each permalink so assistive tech knows what the link is
  • Make focus visible when focusing permalinks and edit links. Previously there was either no focus outline (on edit links) or the element still had opacity 0 (permalinks)
  • Move permalink to the end of the heading, so that the heading text is read first. This required tweaking some of the positioning CSS for the permalink

I was unable to fix all the permalinks, since the docs markdown is now being rendered via a GH action. If these changes look good, I'll make a corresponding PR there to update the permalink rendering.

I'd still like to fix the permalinks on the svelte.dev docs, but I think it's best to wait until it's moved into the site monorepo.

@@ -566,3 +566,16 @@ input[type='checkbox']::after {
input[type='checkbox']:checked::after {
left: calc(100% - 1em + 2px);
}

/* visually hidden, but accessible to assistive tech */
.visually-hidden {
Copy link
Member

Choose a reason for hiding this comment

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

I'm actually not much of a Svelte expert despite working on it a fair bit. Is there a reason to put this here instead of in Permalink.svelte?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I did this intentionally. visually-hidden is a common utility class used to hide content visually but still expose it to screen readers. It won't just be used in the Permalink component -- for instance, if I update the rendered markdown from the API to use that class, it will need to be available globally.

It could also be used in the future to hide other text, e.g. like hiding <h1>s on the Svelte docs.

@benmccann benmccann merged commit 766775d into sveltejs:master Apr 24, 2021
tomoam added a commit to tomoam/sites that referenced this pull request Mar 10, 2023
* fix: OGP for Japanese

* fix: OGP for Japanese

* fix

* add overflow-wrap

* fix css

* Update Card.svelte
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.

2 participants