Fix navigation and table of contents highlighting issues (#169)

This commit is contained in:
Eduard Gert
2024-03-15 16:33:03 +01:00
committed by GitHub
parent a7d0a1bbc8
commit 6a97841307
3 changed files with 6 additions and 7 deletions

View File

@@ -18,8 +18,9 @@ export function NavigationStateProvider({ children,index }) {
});
links.shift();
const activeGroupTitle = groupTitle ? groupTitle : document.querySelector(`.outer-wrapper-${index} [data-nb-active="1"]`)?.getAttribute('data-nb-link');
const activeIndex = links.findIndex((link) => link === "1");
const activeGroupIndex = links.findIndex((link) => link === groupTitle);
const activeGroupIndex = links.findIndex((link) => link === activeGroupTitle);
if(activeGroupIndex !== -1 && activeIndex === -1){
setActiveIndex(activeGroupIndex);
@@ -30,7 +31,7 @@ export function NavigationStateProvider({ children,index }) {
}
useEffect(() => {
setActiveHighlight();
setActiveHighlight().then();
}, [router.pathname]);
return (