fix: close open menus on route change
This commit is contained in:
parent
7357615f00
commit
d93df082a2
1 changed files with 13 additions and 0 deletions
|
|
@ -143,6 +143,7 @@ frappe.ui.menu = class ContextMenu {
|
|||
}
|
||||
|
||||
this.visible = true;
|
||||
frappe.visible_menus.push(this);
|
||||
}
|
||||
close_all_other_menu() {
|
||||
$(".context-menu").hide();
|
||||
|
|
@ -183,6 +184,7 @@ frappe.ui.menu = class ContextMenu {
|
|||
};
|
||||
|
||||
frappe.menu_map = {};
|
||||
frappe.visible_menus = [];
|
||||
|
||||
frappe.ui.create_menu = function (opts) {
|
||||
if (!opts.right_click) $(opts.parent).css("cursor", "pointer");
|
||||
|
|
@ -229,3 +231,14 @@ frappe.ui.create_menu = function (opts) {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
function close_all_open_menus() {
|
||||
frappe.visible_menus.forEach((menu) => {
|
||||
menu.hide();
|
||||
});
|
||||
frappe.visible_menus = [];
|
||||
}
|
||||
|
||||
frappe.router.on("change", function () {
|
||||
close_all_open_menus();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue