mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-07-17 02:30:59 +02:00
Addressed feedback
This commit is contained in:
parent
4e8e251f32
commit
0513ad4d15
@ -100,6 +100,8 @@ export default ((userOpts?: Partial<Options>) => {
|
||||
data-pagepathstate={opts.usePagePath}
|
||||
data-tree={jsonTree}
|
||||
data-mobile={true}
|
||||
aria-controls="explorer-content"
|
||||
aria-expanded={false}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@ -126,6 +128,8 @@ export default ((userOpts?: Partial<Options>) => {
|
||||
data-pagepathstate={opts.usePagePath}
|
||||
data-tree={jsonTree}
|
||||
data-mobile={false}
|
||||
aria-controls="explorer-content"
|
||||
aria-expanded={true}
|
||||
>
|
||||
<h2>{opts.title ?? i18n(cfg.locale).components.explorer.title}</h2>
|
||||
<svg
|
||||
|
@ -54,6 +54,13 @@ function toggleFolder(evt: MouseEvent) {
|
||||
function toggleExplorer(this: HTMLElement) {
|
||||
// Toggle collapsed state of entire explorer
|
||||
this.classList.toggle("collapsed")
|
||||
|
||||
// Toggle collapsed aria state of entire explorer
|
||||
this.setAttribute(
|
||||
"aria-expanded",
|
||||
this.getAttribute("aria-expanded") === "true" ? "false" : "true",
|
||||
)
|
||||
|
||||
const content = (
|
||||
this.nextElementSibling?.nextElementSibling
|
||||
? this.nextElementSibling.nextElementSibling
|
||||
@ -120,7 +127,10 @@ function setupExplorer() {
|
||||
currentExplorerState = []
|
||||
|
||||
for (const { path, collapsed } of newExplorerState) {
|
||||
currentExplorerState.push({ path, collapsed: usePagePathState ? oldIndex.get(path) ?? collapsed : collapsed })
|
||||
currentExplorerState.push({
|
||||
path,
|
||||
collapsed: usePagePathState ? (oldIndex.get(path) ?? collapsed) : collapsed,
|
||||
})
|
||||
}
|
||||
|
||||
currentExplorerState.map((folderState) => {
|
||||
@ -166,7 +176,6 @@ document.addEventListener("nav", () => {
|
||||
}
|
||||
}
|
||||
setupExplorer()
|
||||
//add collapsed class to all folders
|
||||
|
||||
observer.disconnect()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user