From 5f999b4d757acc4fd6399bd5aa30ffa197848738 Mon Sep 17 00:00:00 2001 From: Leon Zandman Date: Sat, 21 Mar 2026 13:48:13 +0100 Subject: [PATCH] Fix: Improve drag-and-drop handling for operations in Safari --- src/web/waiters/OperationsWaiter.mjs | 3 ++- src/web/waiters/RecipeWaiter.mjs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/web/waiters/OperationsWaiter.mjs b/src/web/waiters/OperationsWaiter.mjs index 45a40c82..41c7452c 100755 --- a/src/web/waiters/OperationsWaiter.mjs +++ b/src/web/waiters/OperationsWaiter.mjs @@ -183,10 +183,11 @@ class OperationsWaiter { * @param {Element} el - The element to start selecting from */ enableOpsListPopovers(el) { + const self = this; $(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]") .popover({trigger: "manual"}) .on("mouseenter", function(e) { - if (e.buttons > 0) return; // Mouse button held down - likely dragging an operation + if (e.buttons > 0 || self.manager.recipe.dragInProgress) return; // Mouse button held down - likely dragging an operation const _this = this; $(this).popover("show"); $(".popover").on("mouseleave", function () { diff --git a/src/web/waiters/RecipeWaiter.mjs b/src/web/waiters/RecipeWaiter.mjs index 93ca1182..eb26b97c 100755 --- a/src/web/waiters/RecipeWaiter.mjs +++ b/src/web/waiters/RecipeWaiter.mjs @@ -26,6 +26,7 @@ class RecipeWaiter { this.app = app; this.manager = manager; this.removeIntent = false; + this.dragInProgress = false; } @@ -88,6 +89,7 @@ class RecipeWaiter { * @param {element} listEl - The list to initialise */ createSortableSeedList(listEl) { + const self = this; Sortable.create(listEl, { group: { name: "recipe", @@ -99,6 +101,7 @@ class RecipeWaiter { dataTransfer.setData("Text", dragEl.textContent); }, onStart: function(evt) { + self.dragInProgress = true; // Removes popover element and event bindings from the dragged operation but not the // event bindings from the one left in the operations list. Without manually removing // these bindings, we cannot re-initialise the popover on the stub operation. @@ -126,6 +129,7 @@ class RecipeWaiter { * @param {event} evt */ opSortEnd(evt) { + this.dragInProgress = false; if (this.removeIntent && evt.item.parentNode.id === "rec-list") { evt.item.remove(); return;