Skip to content

Commit 63609bd

Browse files
committed
ACP2E-816: Magento 2.4.4 frontend menu mobile
1 parent 82ecd9d commit 63609bd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/web/mage/menu.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,22 @@ define([
437437
target = $(event.target).closest('.ui-menu-item');
438438
target.get(0).scrollIntoView();
439439

440+
// Open submenu on click
441+
if (target.has('.ui-menu').length) {
442+
this.expand(event);
443+
} else if (!this.element.is(':focus') &&
444+
$(this.document[0].activeElement).closest('.ui-menu').length
445+
) {
446+
// Redirect focus to the menu
447+
this.element.trigger('focus', [true]);
448+
449+
// If the active item is on the top level, let it stay active.
450+
// Otherwise, blur the active item since it is no longer visible.
451+
if (this.active && this.active.parents('.ui-menu').length === 1) { //eslint-disable-line
452+
clearTimeout(this.timer);
453+
}
454+
}
455+
440456
if (!target.hasClass('level-top') || !target.has('.ui-menu').length) {
441457
window.location.href = target.find('> a').attr('href');
442458
}

0 commit comments

Comments
 (0)