mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-19 00:46:35 +00:00
Fix navigation and table of contents highlighting issues (#169)
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user