From 001f2e3ed1d15bf2bb3e874a472fd6da25f47a5a Mon Sep 17 00:00:00 2001 From: Zen Voich Date: Mon, 25 Nov 2024 12:49:10 +0400 Subject: [PATCH] [frontend] fix package docs scroll to definition --- frontend/components/package/PackageDocs.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/components/package/PackageDocs.svelte b/frontend/components/package/PackageDocs.svelte index f4d2c07d..8f77da20 100644 --- a/frontend/components/package/PackageDocs.svelte +++ b/frontend/components/package/PackageDocs.svelte @@ -255,9 +255,10 @@ let id = window.location.hash.slice(1); let el = document.querySelector(`[id="${id}"]`) as HTMLElement; if (!el) { + console.log(`Definition not found: ${id}`); return; } - document.body.scroll({ + document.scrollingElement.scroll({ top: el.offsetTop - docHeaderEl.offsetHeight - 10, behavior: 'smooth', });