fix(theme): improve docs sidebar accessibility#12283
Conversation
Replace the outer complementary aside with a div, use a single nav landmark for the sidebar, and hide the duplicate logo from screen readers when the navbar is visible. Fixes facebook#8429. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @yoshibase! 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 cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Please fix one thing at a time, not 3. And respect our issue template: you must tell us exactly how to test your changes Note: We do not accept vibe-coded PRs that you throw at Cursor and do not even understand. Please show that you actually put human work behind this PR, by showing you clear understanding of each things you try to fix. |
|
Thanks for the feedback. Two changes:
|
|
Closing this PR — branch history rewrite left the PR head stuck on the old commit. Reopened the work as #12291 with:
|
Summary
Fixes #8429 (landmark structure only)
The docs sidebar currently nests landmarks: an outer
<aside>(complementary) wraps an inner<nav aria-label="Docs sidebar">. NVDA announces both before you reach any doc link — "complementary landmark … docs sidebar navigation landmark …".This PR:
<aside>with a plain<div>container (no complementary landmark)<nav aria-label="Docs sidebar">to wrap the logo, menu, and collapse button togetherIssue #8429 also mentions hiding the duplicate sidebar logo from screen readers when
navbar.hideOnScrollis on. I left that out of this PR on purpose — I will open a separate follow-up for it so reviewers can evaluate one concern at a time.Test plan
Preview: https://deploy-preview-12283--docusaurus-2.netlify.app/docs/introduction
Compare against main: https://docusaurus.io/docs/introduction
Tools: Chrome, NVDA (Windows) or VoiceOver (macOS), DevTools
1. Inspect the DOM (Chrome DevTools)
Expected after this PR:
On main today:
The point: one
navigationlandmark for the sidebar, notcomplementary+navigation.2. NVDA landmark list
<aside>)3. Keyboard navigation still works
4. VoiceOver spot check (macOS)
5. axe DevTools (optional)
Scan the page with axe DevTools. Removing a redundant
<aside>should not introduce new violations. Landmark-related informational notices are fine — compare against main rather than expecting zero notices.What proves the fix
Steps 1–2 show the sidebar is exposed as one navigation landmark instead of complementary + navigation stacked together. That matches the structure requested in #8429.