From 56b80ff4cfef2cb48f350f7ebeccbc4ae794b448 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Oct 2026 14:53:28 -0700 Subject: [PATCH] fix(gui): run a context menu item once on a double-click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The menu stays clickable during its 200ms fade-out, so the second click of a double-click ran the item again: double-clicking Share… or Properties in the dashboard opened two stacked dialogs. A menu that has started closing now ignores item clicks. --- src/gui/src/UI/UIContextMenu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/src/UI/UIContextMenu.js b/src/gui/src/UI/UIContextMenu.js index 070e7078b..627abb7d1 100644 --- a/src/gui/src/UI/UIContextMenu.js +++ b/src/gui/src/UI/UIContextMenu.js @@ -605,6 +605,7 @@ function UIContextMenu (options) { const fade_remove = (item) => { const parent_data_id = $(item).closest('.context-menu').attr('data-parent-id'); const $stack = $(`#context-menu-${menu_id}, .context-menu[data-element-id="${parent_data_id}"]`); + $stack.addClass('context-menu-closing'); // Animate visible menus out. fadeOut's callback does not fire on // already-hidden elements (e.g. a parent sheet hidden when its submenu // opened), so force-remove the whole stack after the animation. @@ -638,6 +639,11 @@ function UIContextMenu (options) { // An item is clicked. Bound on the menu, not delegated from document, so // the handler (and the items its closure holds) goes when the menu does. $(contextMenu).on('click', 'li:not(.context-menu-item-disabled)', function (e) { + // A double-click's second click lands while the menu fades out; the + // item has run already (opening a dialog twice, say). + if ( $(contextMenu).hasClass('context-menu-closing') ) { + return false; + } // onClick if ( options.items[$(this).attr('data-action')].onClick && typeof options.items[$(this).attr('data-action')].onClick === 'function' ) {