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

FSE: Add skip link #21507

Closed
carolinan opened this issue Apr 9, 2020 · 4 comments
Closed

FSE: Add skip link #21507

carolinan opened this issue Apr 9, 2020 · 4 comments
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress

Comments

@carolinan
Copy link
Contributor

A skip link helps users skip repetitive blocks of content, like a header area and top navigation menu.

A skip link needs to:

  • Be the first focusable object on the page

  • Become visible when it receives focus

  • Point to the content area of the site correctly

  • A skip link may be hidden until it receives focus.

  • Multiple skip links may also be used.

This is part of the WCAG guideline stating that a website must be navigable.
https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-skip.html
https://make.wordpress.org/themes/handbook/review/accessibility/required/#skip-links

Theme authors add this to their theme as the first element of the body manually, or
by using wp_body_open().

The target is usually the ID of the content wrapper, for example the main landmark.

Because this is an accessibility feature, it should be available for all themes,
not relying on the theme author to remember to add it.

Because the skip link must be the first element of a page, it is not suitable for a
paragraph block with a link and a skip-link CSS class, because the block can then be moved and removed.

Here is one thought on how the skip link could work for FSE,
props @aristath:

If the template in FSE contains a "content" block, then we could add an ID to it and automatically
add the skip-link.
If there is no content block, then the skip-link would point to the loop block.
If there is no loop-block either, then make an educated guess and point to the 1st title or p block.

@aristath
Copy link
Member

aristath commented Sep 14, 2020

I've been thinking about this one and try to figure out how we can handle it... It would be relatively easy to do via JS on the frontend but not as easy to do via PHP server-side.
I'm not sure adding JS on the frontend would be an acceptable solution 🤔
If it is then I can start working on it


EDIT: A quick proof of concept can be seen on my playground: aristath/q@bb636ee#diff-35544253460425360293cc0e84b7b037R26-R78

aristath added a commit to aristath/q that referenced this issue Sep 14, 2020
@mtias
Copy link
Member

mtias commented Nov 19, 2020

Just a note here that a next step on template parts is adding some structural semantics (#26599), so that we can start identifying parts of a design better within the editing flow — from there we'll move on to ensure things like IDs, doc outline support, semantic HTML, etc, are in good shape, which will then allow doing tasks like this one quite straightforwardly.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 11, 2021
@aristath
Copy link
Member

PR in #28946

@aristath
Copy link
Member

Closing this one, it was fixed in #30336

@priethor priethor added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants