Skip to content

Commit

Permalink
feat(theme-classic): autoscroll TOC with active link (#6317)
Browse files Browse the repository at this point in the history
* feat(theme-common): add smooth TOC scrolling to active link

* docs: change the link of repeated content category in lifecycle api

* Update lifecycle-apis.md

* fix page container scrolling

Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
cerkiewny and Josh-Cena authored Jan 13, 2022
1 parent 02a233a commit 2f97a85
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2f97a85

Please sign in to comment.