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

aXe / accessibility: missing region around Skip link in theme-classic #6252

Closed
7 tasks done
JoshuaKGoldberg opened this issue Jan 2, 2022 · 2 comments · Fixed by #6288
Closed
7 tasks done

aXe / accessibility: missing region around Skip link in theme-classic #6252

JoshuaKGoldberg opened this issue Jan 2, 2022 · 2 comments · Fixed by #6288
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Jan 2, 2022

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

aXe 4.1: region specifies:

Ensure all content is contained within a landmark region, designated with HTML5 landmark elements and/or ARIA landmark regions.

...

Navigating a web page is far simpler for screen reader users if the content splits between multiple high-level sections. Content outside of sections is difficult to find, and the content's purpose may be unclear.

The Skip to main content link is an excellent + necessary thing to have on a webpage (♥) but is itself not in any region right now. That's causing aXe to log a failure when run with Enable Best Practices enabled.

Steps to reproduce

  1. Create a new Docusaurus site with the classic theme, such as today's https://typescript-eslint.io
  2. Run aXe on it such as with the aXe browser extensions and Settings > Enable Best Practices enabled

Alternately, see these cypress-axe failures: https://github.com/typescript-eslint/typescript-eslint/runs/4685834360?check_suite_focus=true

"html": "<div><a href=\"#\" class=\"skipToContent__-_-node_modules-@docusaurus-theme-classic-lib-next-theme-SkipToContent-styles-module\">Skip to main content</a></div>",
"target": [
    "#__docusaurus > div:nth-child(2)"
],
"failureSummary": "Fix any of the following:\n  Some page content is not contained by landmarks"

Expected behavior

Some kind of role wrapped around the skip-to-main-content link.

For example, on codecademy.com/docs, we use a role="region".

Actual behavior

No region around the link.

Your environment

Reproducible demo

typescript-eslint/typescript-eslint#4362

Self-service

  • I'd be willing to fix this bug myself.
@JoshuaKGoldberg JoshuaKGoldberg added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jan 2, 2022
@Josh-Cena Josh-Cena added status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this and removed status: needs triage This issue has not been triaged by maintainers labels Jan 3, 2022
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Jan 3, 2022

Makes sense! Feel free to send a PR😉

There seems to be a history of this. See #3650, #4162 @lex111 any particular reason why #4162 reverted the nav landmark back to a plain div?

@lex111
Copy link
Contributor

lex111 commented Jan 12, 2022

@Josh-Cena probably did not find appropriate landmark for that element (the choice of nav was wrong), and did not know about region role, so this is good fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants