diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index 91b02d015..7f1a6aeb0 100644 --- a/quartz/components/scripts/popover.inline.ts +++ b/quartz/components/scripts/popover.inline.ts @@ -130,7 +130,7 @@ async function mouseEnterHandler( const targetID = `popover-internal-${el.id}` el.id = targetID }) - const elts = Array.from(html.getElementsByClassName("popover-hint")) + const elts = [...html.getElementsByClassName("popover-hint")] if (elts.length === 0) return elts.forEach((elt) => popoverInner.appendChild(elt)) diff --git a/quartz/components/scripts/util.ts b/quartz/components/scripts/util.ts index 4d4c80001..66fe60c4e 100644 --- a/quartz/components/scripts/util.ts +++ b/quartz/components/scripts/util.ts @@ -161,20 +161,15 @@ export function scrollInContainerToElement( highlight: boolean = true, behavior: ScrollBehavior = "instant", ) { - // Use requestAnimationFrame to ensure content is rendered before scrolling - requestAnimationFrame(() => { - const targetPosition = target.offsetTop - buffer - container.scroll({ - top: Math.max(0, targetPosition), - behavior, - }) - - // Add highlight effect if requested - if (highlight) { - // Small delay to ensure scroll completes before highlighting - setTimeout(() => { - highlightElement(target) - }, 50) - } + // Scroll immediately, since content should already be rendered in a static site + const targetPosition = target.offsetTop - buffer + container.scroll({ + top: Math.max(0, targetPosition), + behavior, }) + + // Add highlight effect if requested + if (highlight) { + highlightElement(target) + } }