From cfbaba81c240b438a4d790fa63d5472b14d9b92c Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 26 Aug 2019 10:37:30 +0000 Subject: [PATCH] [FIX] website: correctly close dropdown menu on scroll Before this commit, the code that was supposed to close the dropdown in the navbar when scrolling was not working anymore. Indeed, it would removes the `show` class from the `nav-item dropdown` (dropdown menu entry) but not from the `dropdown-menu` (dropdown content). Fixes #35320 closes odoo/odoo#36069 Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/js/content/menu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index d64a3891bfd..00af3201b81 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -21,6 +21,7 @@ sAnimation.registry.affixMenu = sAnimation.Class.extend({ this.$headerClone.insertAfter(this.$target); this.$headers = this.$target.add(this.$headerClone); this.$dropdowns = this.$headers.find('.dropdown'); + this.$dropdownMenus = this.$headers.find('.dropdown-menu'); this.$navbarCollapses = this.$headers.find('.navbar-collapse'); // Handle events for the collapse menus @@ -69,7 +70,7 @@ sAnimation.registry.affixMenu = sAnimation.Class.extend({ this.$headerClone.toggleClass('affixed', wOffset > (hOffset + 300)); // Reset opened menus - this.$dropdowns.removeClass('show'); + this.$dropdowns.add(this.$dropdownMenus).removeClass('show'); this.$navbarCollapses.removeClass('show').attr('aria-expanded', false); }, });