diff --git a/src/implementations/twig/components/mega-menu/__snapshots__/mega-menu.test.js.snap b/src/implementations/twig/components/mega-menu/__snapshots__/mega-menu.test.js.snap index df1f7d7de3..9c6c3c5532 100644 --- a/src/implementations/twig/components/mega-menu/__snapshots__/mega-menu.test.js.snap +++ b/src/implementations/twig/components/mega-menu/__snapshots__/mega-menu.test.js.snap @@ -59,7 +59,6 @@ exports[`Mega Menu Default renders correctly 1`] = `
+
{%- if _back_label is not empty -%} {% include '@ecl/button/button.html.twig' with { diff --git a/src/implementations/twig/components/menu/__snapshots__/menu.test.js.snap b/src/implementations/twig/components/menu/__snapshots__/menu.test.js.snap index b92c72a739..eb71bb7876 100644 --- a/src/implementations/twig/components/menu/__snapshots__/menu.test.js.snap +++ b/src/implementations/twig/components/menu/__snapshots__/menu.test.js.snap @@ -52,7 +52,6 @@ exports[`Menu Default renders correctly 1`] = ` aria-label="Menu" class="ecl-menu__inner" data-ecl-menu-inner="" - role="application" >
+
{% if _close is not empty %} {% include '@ecl/button/button.html.twig' with _close|merge({ diff --git a/src/implementations/vanilla/components/menu/menu.js b/src/implementations/vanilla/components/menu/menu.js index 837462e543..3af562122c 100644 --- a/src/implementations/vanilla/components/menu/menu.js +++ b/src/implementations/vanilla/components/menu/menu.js @@ -830,14 +830,6 @@ export class Menu { // Key actions to toggle the caret buttons if (cList.contains('ecl-menu__button-caret') && menuExpanded === 'false') { - if (e.keyCode === 32 || e.key === 'Enter') { - if (menuItem.getAttribute('aria-expanded') === 'true') { - this.handleHoverOffItem(e); - } else { - this.handleHoverOnItem(e); - } - return; - } if (e.key === 'ArrowDown') { e.preventDefault(); const firstItem = queryOne( @@ -898,8 +890,6 @@ export class Menu { } } } - - this.closeOpenDropdown(); } // Key actions to navigate between the sub-links @@ -1140,18 +1130,25 @@ export class Menu { * @param {Event} e */ handleClickOnCaret(e) { - // Don't execute for desktop display const menuExpanded = this.element.getAttribute('aria-expanded'); + const menuItem = e.target.closest(this.itemSelector); + + // Desktop display if (menuExpanded === 'false') { + if (menuItem.getAttribute('aria-expanded') === 'true') { + this.handleHoverOffItem(e); + } else { + this.handleHoverOnItem(e); + } return; } + // Mobile display // Add css class to inner menu this.inner.classList.add('ecl-menu__inner--expanded'); // Add css class and attribute to current item, and remove it from others // Also save the current item - const menuItem = e.target.closest(this.itemSelector); this.items.forEach((item) => { if (item === menuItem) { item.classList.add('ecl-menu__item--expanded');