diff --git a/src/Header/Nav/index.tsx b/src/Header/Nav/index.tsx index 4db9a27..74287f0 100644 --- a/src/Header/Nav/index.tsx +++ b/src/Header/Nav/index.tsx @@ -56,7 +56,6 @@ function groupChildren(children: NavChild[]): { heading: string | null; links: N return result } -/* ── Priority #4: Focus trap hook for mobile menu ──────────────────── */ function useFocusTrap(containerRef: React.RefObject, active: boolean) { useEffect(() => { if (!active || !containerRef.current) return @@ -68,10 +67,8 @@ function useFocusTrap(containerRef: React.RefObject, active: const getFocusableElements = () => Array.from(container.querySelectorAll(focusableSelector)) - // Focus the first focusable element when trap activates const elements = getFocusableElements() if (elements.length > 0) { - // Small delay to ensure the menu transition has started setTimeout(() => elements[0]?.focus(), 100) } @@ -102,16 +99,13 @@ function useFocusTrap(containerRef: React.RefObject, active: }, [active, containerRef]) } -/* ── Priority #10: Check if a nav item matches current path ────────── */ function isActiveSection(item: NavItem, pathname: string | null): boolean { if (!pathname || !item.children?.length) { - // For top-level links without children, check direct href match const href = resolveHref(item) if (href === '/') return pathname === '/' return pathname?.startsWith(href) || false } - // For dropdown parents, check if any child href matches return item.children.some((child) => { const childHref = resolveHref(child) if (childHref === '/' || childHref === '#') return false @@ -119,7 +113,6 @@ function isActiveSection(item: NavItem, pathname: string | null): boolean { }) } - const MegaMenuPanel: React.FC<{ item: NavItem headerRef: React.RefObject @@ -155,7 +148,7 @@ const MegaMenuPanel: React.FC<{ onClick={onClose} /> - {/* Panel — white in light, navy in dark */} + {/* Panel */}
(null) const mobileMenuRef = useRef(null) - // Priority #4: Focus trap useFocusTrap(mobileMenuRef, mobileOpen) useEffect(() => { @@ -275,13 +267,12 @@ export const HeaderNav: React.FC<{ data: HeaderType; socialLinks?: SocialLinkDat return ( <> - {/* ── Desktop nav ── */} -