fix(explorer): unintended page scroll when opening low-positioned items in explorer

Replaced scrollIntoView with scrollTop = offsetTop to prevent the entire page from scrolling when an .active item is located near the bottom of the explorer list. Now only the explorer panel scrolls, preserving the main view position.
This commit is contained in:
Alexey Chernyavskiy 2025-07-27 09:13:15 +05:00
parent 99414d5419
commit 47654cacbe
No known key found for this signature in database
GPG Key ID: 402AE34C2F14446E

View File

@ -222,9 +222,9 @@ async function setupExplorer(currentSlug: FullSlug) {
explorerUl.scrollTop = parseInt(scrollTop) explorerUl.scrollTop = parseInt(scrollTop)
} 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") as HTMLElement | null
if (activeElement) { if (activeElement) {
activeElement.scrollIntoView({ behavior: "smooth" }) explorerUl.scrollTop = activeElement.offsetTop
} }
} }