This commit is contained in:
Yòmá 2025-12-12 13:04:48 +09:00 committed by GitHub
commit 23b4c11cb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -223,8 +223,18 @@ async function setupExplorer(currentSlug: FullSlug) {
} else { } else {
// try to scroll to the active element if it exists // try to scroll to the active element if it exists
const activeElement = explorerUl.querySelector(".active") const activeElement = explorerUl.querySelector(".active")
if (activeElement) { const scrollContainer = explorer.querySelector(".explorer-content ul")
activeElement.scrollIntoView({ behavior: "smooth" })
if (activeElement && scrollContainer) {
const offset =
activeElement.getBoundingClientRect().top -
scrollContainer.getBoundingClientRect().top +
scrollContainer.scrollTop
scrollContainer.scrollTo({
top: offset,
behavior: "smooth"
})
} }
} }