MDL-83984 core: Fixed subpanel show/hide issue

This commit is contained in:
Santosh Nagargoje
2026-01-06 16:19:21 +05:30
parent 6e82b46a48
commit 4c53960c75
3 changed files with 18 additions and 3 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+16 -1
View File
@@ -151,6 +151,18 @@ class SubPanel {
this.element.dataset.subPanelInitialized = true;
}
/**
* Hides the subpanel when mouse leaves the menu item.
* @param {Event} event
*/
_hideCurrentSubPanel(event) {
// Only hide if not hovering over the menu item or subpanel content.
const related = event.relatedTarget;
if (!this.menuItem.contains(related) && !this.panelContent.contains(related)) {
this.setVisibility(false);
}
}
/**
* Checks if the subpanel has enough space.
*
@@ -223,13 +235,16 @@ class SubPanel {
/**
* Menu item hover out handler.
* @param {Event} event
* @private
*/
_menuItemHoverOutHandler() {
_menuItemHoverOutHandler(event) {
if (this._needSmallSpaceBehaviour()) {
return;
}
this._hideOtherSubPanels();
// Hide subpanel when the menu item itself is not hovered.
this._hideCurrentSubPanel(event);
}
/**