Skip to content

Commit

Permalink
fix scroll to parent
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerwizard committed Dec 12, 2024
1 parent 5418a8f commit 78016e4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/theme/DocSidebar/Desktop/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden, ...props}) {
const sidebarRef = useRef(null);

useEffect(() => {
// Get the current active link
const activeLink = sidebarRef.current?.querySelector('.menu__link--active');

// Get all current active links
const activeLinks = sidebarRef.current?.querySelectorAll('.menu__link--active');
// last entry should be deepest
const activeLink = activeLinks[activeLinks.length - 1];
if (activeLink) {
const linkRect = activeLink.getBoundingClientRect();
const isVisible = (
Expand Down

0 comments on commit 78016e4

Please sign in to comment.