Skip to content

Commit 7604b25

Browse files
authored
Merge pull request #2895 from ClickHouse/issue_2869
fix scroll to parent
2 parents 58be97e + 78016e4 commit 7604b25

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/theme/DocSidebar/Desktop/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden, ...props}) {
1717
const sidebarRef = useRef(null);
1818

1919
useEffect(() => {
20-
// Get the current active link
21-
const activeLink = sidebarRef.current?.querySelector('.menu__link--active');
22-
20+
// Get all current active links
21+
const activeLinks = sidebarRef.current?.querySelectorAll('.menu__link--active');
22+
// last entry should be deepest
23+
const activeLink = activeLinks[activeLinks.length - 1];
2324
if (activeLink) {
2425
const linkRect = activeLink.getBoundingClientRect();
2526
const isVisible = (

0 commit comments

Comments
 (0)