From b69b78be6470c0daa2cecb6a1d296ca256ad7acf Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 12 Sep 2024 16:36:33 +0200 Subject: [PATCH] Avoid flicker when scrolling to anchor (#7263) * Avoid flicker when scrolling to anchor * Fix --- panel/models/html.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panel/models/html.ts b/panel/models/html.ts index 64f985e158..d64a133181 100644 --- a/panel/models/html.ts +++ b/panel/models/html.ts @@ -159,7 +159,10 @@ export class HTMLView extends PanelMarkupView { } }) if (!this.root.has_finished() && this.model.document && window.location.hash === link) { - this.model.document.on_event("document_ready", () => setTimeout(() => anchor.scrollIntoView(), 5)) + this.model.document.on_event("document_ready", () => { + anchor.scrollIntoView() + setTimeout(() => anchor.scrollIntoView(), 5) + }) } } }