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

Add skip link #447

Open
marcinkrzeminski opened this issue Sep 16, 2019 · 0 comments
Open

Add skip link #447

marcinkrzeminski opened this issue Sep 16, 2019 · 0 comments

Comments

@marcinkrzeminski
Copy link
Collaborator

marcinkrzeminski commented Sep 16, 2019

It's an a11y good practice to have a skip link.

It's might look like something like this:

templates/layout/base.twig

<a class="u-screen-reader-text" href="#content">
  {{ __('Skip to content', 'text-domain') }}
</a>

...
...

<main id="content" aria-label="{{ __('Content', 'text-domain') }}">
  {% block content %}
    {{ __('Sorry, no content', 'text-domain') }}
  {% endblock %}
</main>

src/styles/utilities/_hide.scss

.u-screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal;

  &:focus {
    background-color: lighten($color-grey-very-light, 10%);
    clip: auto;
    clip-path: none;
    color: $color-black;
    display: block;
    font-size: 1em;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000; /* Above WP toolbar. */
  }
}
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

No branches or pull requests

1 participant