diff --git a/app/components/Navbar.tsx b/app/components/Navbar.tsx index b39f219..65762f0 100644 --- a/app/components/Navbar.tsx +++ b/app/components/Navbar.tsx @@ -383,6 +383,16 @@ export function Navbar({ singleActiveProduct }: { singleActiveProduct: boolean } // header itself to be a flexible column that could grow for it — it's // now a fixed-position sibling instead (see that panel's own comment // on why), so this is back to a plain fixed-height bar. + // + // onClick here closes the drawer on any click that lands on the bar + // itself (logo/cart/account/CTAs already call closeMobile() from + // their own onClick, so this mainly covers clicking empty space in + // the bar) — safe as a catch-all specifically because the panel is + // a sibling, not a descendant, so a click inside the open drawer + // never bubbles up to this handler. The hamburger's own onClick + // stops propagation so toggling it open doesn't immediately get + // undone by this same handler. + onClick={() => mobileOpen && setMobileOpen(false)} className={`sticky top-0 z-50 w-full h-[6.25rem] transition-[background-color,backdrop-filter] duration-300 ${ scrolled || mobileOpen ? "bg-bg-base/80 backdrop-blur-md" @@ -535,7 +545,10 @@ export function Navbar({ singleActiveProduct }: { singleActiveProduct: boolean } aria-expanded={mobileOpen} aria-controls="mobile-nav-panel" aria-label={mobileOpen ? "Menü schließen" : "Menü öffnen"} - onClick={() => setMobileOpen((v) => !v)} + onClick={(e) => { + e.stopPropagation(); + setMobileOpen((v) => !v); + }} className="lg:hidden flex h-11 w-11 items-center justify-center shrink-0" >