fix: Another fix for heading scrolling
This commit is contained in:
@@ -94,12 +94,9 @@ const NavLink = ({
|
||||
React.useLayoutEffect(() => {
|
||||
if (isActive && linkRef.current && scrollIntoViewIfNeeded !== false) {
|
||||
// If the page has an anchor hash then this means we're linking to an
|
||||
// anchor in the document generally – smooth scrolling the sidebar may
|
||||
// interrupt the scrolling to the anchor of the document so we jump
|
||||
// directly to the anchor instead.
|
||||
if (window.location.hash) {
|
||||
linkRef.current.scrollIntoView();
|
||||
} else {
|
||||
// anchor in the document – smooth scrolling the sidebar may the scrolling
|
||||
// to the anchor of the document so we must avoid it.
|
||||
if (!window.location.hash) {
|
||||
scrollIntoView(linkRef.current, {
|
||||
scrollMode: "if-needed",
|
||||
behavior: "auto",
|
||||
|
||||
Reference in New Issue
Block a user