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