-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Some projects have been implementing "useScrollToTop.ts"
// src/components/useScrollToTop.ts
import { useEffect } from 'react';
import { useLocation } from '@docusaurus/router';
export function useScrollToTop(): void {
const location = useLocation();
useEffect(() => {
const scrollableElement = document.querySelector('.main-wrapper');
if (scrollableElement && scrollableElement.scrollTo) {
scrollableElement.scrollTo(0, 0);
} else {
window.scrollTo(0, 0);
}
}, [location.pathname]);
}
to work around navigation issues. evaluate if this is a problem in the unified doc and if it is expose this to the shared library (lib/packages/docusaurus-shared)
Then, update the dependent doc projects and remove the non-shared version from each repo
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels