From d2d7fd7c4c76dcd2c4aacd0ea2efba4a1766bcb3 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 26 Nov 2025 20:35:02 +0200 Subject: [PATCH] fix(context_menu): toggling submenu hides the menu most of the time --- apps/client/src/menus/context_menu.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts index 7096953e2..939edc284 100644 --- a/apps/client/src/menus/context_menu.ts +++ b/apps/client/src/menus/context_menu.ts @@ -298,8 +298,6 @@ class ContextMenu { // important to use mousedown instead of click since the former does not change focus // (especially important for focused text for spell check) .on("mousedown", (e) => { - e.stopPropagation(); - if (e.which !== 1) { // only left click triggers menu items return false; @@ -313,6 +311,11 @@ class ContextMenu { return false; } + // Prevent submenu from failing to expand on mobile + if (!("items" in item && item.items)) { + this.hide(); + } + if ("handler" in item && item.handler) { item.handler(item, e); } @@ -324,16 +327,6 @@ class ContextMenu { return false; }); - $item.on("mouseup", (e) => { - // Prevent submenu from failing to expand on mobile - if (!this.isMobile || !("items" in item && item.items)) { - e.stopPropagation(); - // Hide the content menu on mouse up to prevent the mouse event from propagating to the elements below. - this.hide(); - return false; - } - }); - if ("enabled" in item && item.enabled !== undefined && !item.enabled) { $item.addClass("disabled"); }