Merge pull request #37054 from aerele/feat/sidebar-hover-based-submenu

feat: add hover functionality for nested submenus in context menu
This commit is contained in:
Ejaaz Khan 2026-04-17 11:33:16 +05:30 committed by GitHub
commit 05919d5d47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -175,8 +175,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({
@ -242,6 +257,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) {