From 47654cacbeb1425666586521362ef67e666ba51b Mon Sep 17 00:00:00 2001 From: Alexey Chernyavskiy Date: Sun, 27 Jul 2025 09:13:15 +0500 Subject: [PATCH] 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. --- quartz/components/scripts/explorer.inline.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/components/scripts/explorer.inline.ts b/quartz/components/scripts/explorer.inline.ts index 9c8341169..c9f55f867 100644 --- a/quartz/components/scripts/explorer.inline.ts +++ b/quartz/components/scripts/explorer.inline.ts @@ -222,9 +222,9 @@ async function setupExplorer(currentSlug: FullSlug) { explorerUl.scrollTop = parseInt(scrollTop) } else { // 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) { - activeElement.scrollIntoView({ behavior: "smooth" }) + explorerUl.scrollTop = activeElement.offsetTop } }