feat: add hover functionality for nested submenus in context menu

This commit is contained in:
Praveenkumar26-S 2026-02-11 11:00:16 +05:30
parent 637d18bc51
commit dea2b7d81e

View file

@ -167,8 +167,23 @@ frappe.ui.menu = class ContextMenu {
if (item.items) {
let nested_menu = this.handle_nested_menu(item_wrapper, item);
this.nested_menus.push(nested_menu);
me.handle_submenu_hover(item_wrapper);
}
}
handle_submenu_hover(item_wrapper) {
const me = this;
$(item_wrapper).on("mouseenter", function (event) {
me.nested_menus.forEach((menu) => {
if (menu.parent.get(0) === this) {
me.current_menu = menu;
menu.show(event);
} else {
menu.hide();
}
});
});
}
handle_nested_menu(item_wrapper, item) {
return frappe.ui.create_menu({
@ -234,6 +249,11 @@ frappe.ui.menu = class ContextMenu {
hide() {
this.template.css("display", "none");
this.visible = false;
if (this.nested_menus && this.nested_menus.length) {
this.nested_menus.forEach((menu) => {
menu.hide();
});
}
}
mouseX(evt) {
if (evt.pageX) {