From 961dd073f616a3b6c1c441c3296ca005db2b30ea Mon Sep 17 00:00:00 2001 From: KerollesFathy Date: Mon, 2 Feb 2026 13:29:50 +0000 Subject: [PATCH] fix: right-click context menu positioning --- frappe/public/js/frappe/ui/menu.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/frappe/public/js/frappe/ui/menu.js b/frappe/public/js/frappe/ui/menu.js index c09b382992..1b84ffa725 100644 --- a/frappe/public/js/frappe/ui/menu.js +++ b/frappe/public/js/frappe/ui/menu.js @@ -179,9 +179,23 @@ frappe.ui.menu = class ContextMenu { show(event) { this.make(); - const parent_rect = this.parent.get(0).getBoundingClientRect(); this.gap = 4; + + if (this.opts.right_click && event) { + this.template.css({ + display: "block", + position: "fixed", + left: `${event.clientX}px`, + top: `${event.clientY}px`, + }); + this.visible = true; + frappe.visible_menus.push(this); + return; + } + + const parent_rect = this.parent.get(0).getBoundingClientRect(); let top, left; + if (this.opts.nested && this.opts.parent_menu) { let parent_menu_el = frappe.menu_map[this.opts.parent_menu].template; let parent_menu_rect = parent_menu_el.get(0).getBoundingClientRect(); @@ -201,13 +215,6 @@ frappe.ui.menu = class ContextMenu { if (left < 0) left = 10; - if (this.opts.right_click) { - this.template.css({ - left: `${event.clientX}px`, - top: `${event.clientY}px`, - }); - } - this.template.css({ display: "block", position: "fixed",