-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix: improve sidebar accessibility structure (#8429) #11038
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,16 +24,19 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}: Props) { | |
} = useThemeConfig(); | ||
|
||
return ( | ||
<div | ||
<nav | ||
className={clsx( | ||
styles.sidebar, | ||
hideOnScroll && styles.sidebarWithHideableNavbar, | ||
isHidden && styles.sidebarHidden, | ||
)}> | ||
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />} | ||
)} | ||
aria-label="docs sidebar"> | ||
{hideOnScroll && ( | ||
<Logo tabIndex={-1} className={styles.sidebarLogo} aria-hidden="true" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my understanding, the When the site navbar is shown, then that logo is behind the navbar so it's hidden: However when the site gets scrolled and the navbar disappears, this logo becomes visible, and is an actual link to the site homepage. In this case I don't believe applying |
||
)} | ||
<Content path={path} sidebar={sidebar} /> | ||
{hideable && <CollapseButton onClick={onCollapse} />} | ||
</div> | ||
</nav> | ||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import type { | |
} from '@docusaurus/types'; | ||
import type {SiteCollectedData} from '../../common'; | ||
import {BuildCLIOptions} from './build'; | ||
import clearPath from '../utils/clearPath'; | ||
|
||
export type BuildLocaleParams = { | ||
siteDir: string; | ||
|
@@ -77,6 +78,11 @@ export async function buildLocale({ | |
props, | ||
configureWebpackUtils, | ||
}), | ||
|
||
// We also clear website/build dir | ||
// returns void, no useful result needed before compilation | ||
// See also https://github.com/facebook/docusaurus/pull/11037 | ||
clearPath(outDir), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not related to accessibility, please remove all the unwanted changes from this PR diff There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, thanks for your feedback and sorry for the late response ! I will just clarify this points : About the Regarding Screen reader testing: Translation of Unrelated changes: Appreciate the thoughtful review! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great Let me know if you plan to improve the PR to meet the requirements |
||
]), | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import path from 'path'; | ||
import {rm} from 'fs/promises'; | ||
import {PerfLogger} from '@docusaurus/logger'; | ||
|
||
/** | ||
* @param pathToClear | ||
*/ | ||
export default async function clearPath(pathToClear: string): Promise<void> { | ||
return PerfLogger.async( | ||
`clearPath ${path.relative(process.cwd(), pathToClear)}`, | ||
async () => { | ||
await rm(pathToClear, {recursive: true, force: true}); | ||
}, | ||
); | ||
} |
This file was deleted.
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.
All our Aria labels should use our translation framework so that they can be localized