fix(explorer): dont invert mobile css, properly toggle .collapsed

This commit is contained in:
Jacky Zhao
2025-03-12 10:15:54 -07:00
parent ca08ec1ae7
commit e3c50caf13
2 changed files with 12 additions and 10 deletions

View File

@ -259,15 +259,17 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
await setupExplorer(currentSlug)
// if mobile hamburger is visible, collapse by default
for (const explorer of document.getElementsByClassName("mobile-explorer")) {
if (explorer.checkVisibility()) {
for (const explorer of document.getElementsByClassName("explorer")) {
const mobileExplorer = explorer.querySelector(".mobile-explorer")
if (!mobileExplorer) return
if (mobileExplorer.checkVisibility()) {
explorer.classList.add("collapsed")
explorer.setAttribute("aria-expanded", "false")
}
}
const hiddenUntilDoneLoading = document.querySelector(".mobile-explorer")
hiddenUntilDoneLoading?.classList.remove("hide-until-loaded")
mobileExplorer.classList.remove("hide-until-loaded")
}
})
function setFolderState(folderElement: HTMLElement, collapsed: boolean) {