diff --git a/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts b/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts index 2283176e0250..fa5d54ba4c40 100644 --- a/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts +++ b/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts @@ -144,6 +144,7 @@ function useTOCHighlight(config: TOCHighlightConfig | undefined): void { } link.classList.add(linkActiveClassName); lastActiveLinkRef.current = link; + link.scrollIntoView({block: 'nearest'}); } else { link.classList.remove(linkActiveClassName); }