fix: close navmenu on navigation

This commit is contained in:
2026-10-07 18:16:29 +02:00
parent 2d06447811
commit 9ba0c59eff
@@ -153,6 +153,8 @@ export function DesktopNav({
useEffect(() => clearCloseTimer, [clearCloseTimer]); useEffect(() => clearCloseTimer, [clearCloseTimer]);
useEffect(() => closeGroup(), [pathname, closeGroup]);
const columnLinks = useCallback((groupId: string): HTMLElement[] => { const columnLinks = useCallback((groupId: string): HTMLElement[] => {
const nav = navRef.current; const nav = navRef.current;
if (!nav) return []; if (!nav) return [];
@@ -490,6 +492,7 @@ export function DesktopNav({
<Link <Link
to={child.href} to={child.href}
data-nav-sublink="" data-nav-sublink=""
onClick={closeGroup}
aria-current={ aria-current={
isCurrentPath(child.href, pathname) ? "page" : undefined isCurrentPath(child.href, pathname) ? "page" : undefined
} }
@@ -520,6 +523,7 @@ export function DesktopNav({
isCurrentPath(item.href, pathname) ? "page" : undefined isCurrentPath(item.href, pathname) ? "page" : undefined
} }
onFocus={closeGroup} onFocus={closeGroup}
onClick={closeGroup}
className={cx( className={cx(
"body-sm-bold whitespace-nowrap pb-[2px] no-underline", "body-sm-bold whitespace-nowrap pb-[2px] no-underline",
/* Same rest/hover/current treatment as a group trigger. */ /* Same rest/hover/current treatment as a group trigger. */