fix(theme): add aria-hidden and aria-label to sidebar logo for access…#12167
Open
MasterIfeanyi wants to merge 1 commit into
Open
fix(theme): add aria-hidden and aria-label to sidebar logo for access…#12167MasterIfeanyi wants to merge 1 commit into
MasterIfeanyi wants to merge 1 commit into
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
The sidebar logo (shown when
hideOnScrollis enabled) was not accessible to screen readers. When the navbar is visible, the logo is visually hidden behind it but had noaria-hiddenattribute, causing screen readers like NVDA to unnecessarily announce it. When the navbar scrolls away and the logo becomes visible and interactive, it had no accessible label at all.This fix adds
aria-hidden={isNavbarVisible}so the logo is hidden from screen readers when it is not visible, and adds a localizedaria-labelvia thetranslate()function when the logo is visible and acting as a real homepage link.Closes #8429
Test Plan
hideOnScroll: truein your Docusaurus site'sthemeConfig.navbarconfig.aria-hidden="true"and noaria-label.aria-hiddenis gone andaria-label="Home page"is present.Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
Closes #8429