From 4e5c44361a27f313f2473f35a3d98e14a1420c41 Mon Sep 17 00:00:00 2001 From: Audrius Date: Wed, 2 Sep 2026 06:02:29 +0200 Subject: [PATCH] Follow the mobile menu state instead of flipping the header class toggleMobileMenu() is called from the menu button and from the 'responsive update' event, which fires on every breakpoint crossing. A crossing opens and closes nothing, so the unconditional toggleClass left #header.is-open inverted with respect to the menu until the next crossing put it back. Read #mobile_top_menu_wrapper's visibility once and drive both the class and the content hiding from it, as the content hiding already did. See PrestaShop/PrestaShop#35939 --- _dev/js/components/top-menu.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_dev/js/components/top-menu.js b/_dev/js/components/top-menu.js index d9aeec4b..ce9ca9b9 100644 --- a/_dev/js/components/top-menu.js +++ b/_dev/js/components/top-menu.js @@ -70,8 +70,12 @@ export default class TopMenu extends DropDown { } toggleMobileMenu() { - $('#header').toggleClass('is-open'); - if ($('#mobile_top_menu_wrapper').is(':visible')) { + // Called both when the menu is toggled and on every breakpoint crossing, + // so the state has to be read rather than flipped. + const isMobileMenuOpen = $('#mobile_top_menu_wrapper').is(':visible'); + + $('#header').toggleClass('is-open', isMobileMenuOpen); + if (isMobileMenuOpen) { $('#notifications, #wrapper, #footer').hide(); } else { $('#notifications, #wrapper, #footer').show();