diff --git a/default.hbs b/default.hbs index 3450d7c..184466b 100644 --- a/default.hbs +++ b/default.hbs @@ -33,7 +33,6 @@ this.open = false; }, openMenu() { - // Only open if we are on a mobile screen to prevent unexpected triggers if (window.innerWidth < 768) { this.open = true; } @@ -41,15 +40,19 @@ }); }); + // Ensure menu is closed during and after navigation document.addEventListener('htmx:beforeRequest', () => { if (window.Alpine) Alpine.store('mobileMenu').close(); }); + document.addEventListener('htmx:afterSettle', () => { + if (window.Alpine) Alpine.store('mobileMenu').close(); + }); {{ghost_head}}
- {{!-- Mobile menu stays outside the boosted area to persist state --}} + {{!-- Mobile menu stays outside the boosted area --}} {{> mobile-menu}}