-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
fix(theme): add missing aria-labels to the main and sidebar navs #8366
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
fix(theme): add missing aria-labels to the main and sidebar navs #8366
Conversation
|
Hi @r-lawrence! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
d9698f1 to
a4acfd1
Compare
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
slorber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's a good start 👍
As the unit test says, you have to run yarn workspace @docusaurus/theme-translations update once ids/labels are good, so that we can merge the PRs. This updates all our default translation files and make the test pass
packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/Content/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/Content/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/Content/index.tsx
Outdated
Show resolved
Hide resolved
| const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll); | ||
| const ariaLabel = translate({ | ||
| id: 'theme.NavBar.mainAriaLabel', | ||
| message: 'Main', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again @Alena5041 is this "Main" label precise enough?
I'm not an expert in screen readers but what will they announce, and will their users understand what this nav is about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it’s enough in this case.
Thanks for all the feedback and information. I'll be working today to update the PR accordingly. update: all changes have been made, translations have been updated with |
a4acfd1 to
800cf93
Compare
800cf93 to
213181d
Compare
213181d to
7349b76
Compare
|
LGTM thanks Fix #8308 |
Pre-flight checklist
Motivation
Looking to make some open source contributions to this repository. I noticed bug Issue #8308 and figured I would take a stab at it.
This PR adds an
aria-labelattribute to navigation bars found on https://docusaurus.io/docs allowing assistive technologies like screen readers to identify unique navigation elements.Test Plan
verify the problem:
<nav>and verify the first and secondnavelements do not contain an aria-label attribute.verify the fix:
npm run start<nav>navelement has anaria-label="Main"navelement has anaria-label="Docs sidebar"before:
main nav:

sidebar nav:

after:
main nav:

sidebar nav:

Test links
Deploy preview: https://deploy-preview-8366--docusaurus-2.netlify.app/
Related issues/PRs
Fix #8308