From ddbd4c42a6a25e41f166f9cbe614b800a70b158a Mon Sep 17 00:00:00 2001 From: Ruben Carlo Benante Date: Tue, 4 Aug 2026 10:57:10 -0300 Subject: [PATCH] New tweak JS for clickable gear subtasks bugfix v2.3.0 --- Asset/js/sortable-handle-fix.js | 57 +++++++++++++++++++++++++++++++++ Plugin.php | 11 ++++++- README.md | 17 ++++++++++ VERSION | 2 +- 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 Asset/js/sortable-handle-fix.js diff --git a/Asset/js/sortable-handle-fix.js b/Asset/js/sortable-handle-fix.js new file mode 100644 index 0000000..2e9b3c6 --- /dev/null +++ b/Asset/js/sortable-handle-fix.js @@ -0,0 +1,57 @@ +/* + * OrganonTweaks -- fix a core Kanboard touch bug on reorder tables. + * + * Kanboard inits the subtask / board-column / swimlane reorder sortables with + * handle:"td:first i", which matches EVERY in a row's first cell -- so the gear/caret menu + * icons and the subtask status checkbox become drag handles too. On touch devices the bundled + * jQuery UI Touch Punch then captures the press on those icons, preventDefault()s the native + * tap-click, and only re-fires a click if the finger did not move at all -- so almost every real + * tap is swallowed and the menu never opens (the gear "drags" instead of opening). + * + * Fix: re-scope the handle option to the real drag icon (.draggable-row-handle) on every such + * sortable, so only the arrows drag and the other first-cell icons are plain clicks again. + * jQuery UI reads options.handle at press time, so this takes effect immediately, no re-init. + * Kanboard re-inits the sortable whenever it re-renders a table (subtask add/edit, column + * reorder, and so on), which re-applies the bad handle -- so we re-apply the fix after every + * render via a debounced MutationObserver. Always on (no setting). Harmless on desktop, where + * the mouse never takes the Touch Punch path. + */ +(function () { + "use strict"; + + var $j = window.jQuery; + if (! $j) { + return; + } + + function fixHandles() { + $j(".ui-sortable").each(function () { + try { + var $s = $j(this); + if ($s.sortable("option", "handle") === "td:first i") { + $s.sortable("option", "handle", ".draggable-row-handle"); + } + } catch (e) { + // element is not an initialized sortable -- skip it + } + }); + } + + var pending = false; + function schedule() { + if (pending) { + return; + } + pending = true; + window.setTimeout(function () { + pending = false; + fixHandles(); + }, 0); + } + + $j(fixHandles); // initial pass on DOM ready + new MutationObserver(schedule).observe(document.body, { + childList: true, + subtree: true + }); +})(); diff --git a/Plugin.php b/Plugin.php index bc2da83..56ce68b 100644 --- a/Plugin.php +++ b/Plugin.php @@ -19,6 +19,15 @@ class Plugin extends Base 'template' => 'plugins/OrganonTweaks/Asset/js/relocate.js', )); + // Fix a core Kanboard touch bug: the subtask / board-column / swimlane reorder sortables + // use handle:"td:first i", which makes the gear/caret menu icons and the subtask status + // checkbox (all in the first cell) drag handles too, so on touch devices Touch Punch + // swallows their taps -- the gear "drags" instead of opening. Re-scope the handle to the + // real drag icon (.draggable-row-handle) in JS. Always on; harmless on desktop. + $this->hook->on('template:layout:js', array( + 'template' => 'plugins/OrganonTweaks/Asset/js/sortable-handle-fix.js', + )); + // Settings page for the plugin's tweaks. $this->template->hook->attach('template:config:sidebar', 'organonTweaks:config/sidebar'); @@ -198,7 +207,7 @@ class Plugin extends Base public function getPluginVersion() { - return '2.2.0'; + return '2.3.0'; } public function getPluginHomepage() diff --git a/README.md b/README.md index 8829d11..008e308 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,23 @@ recolored -- only the badge. the same close-mode/marker-mode semantics as the badge. - **Off by default.** Toggle it under "Settings -> Organon Tweaks". +### Fix the subtask / column / swimlane menus on touch devices + +On phones and tablets the little **gear menu** (edit / remove / convert) on a subtask row -- and the +same gear on the board **Columns** and **Swimlanes** config tables -- was almost impossible to tap: +roughly one tap in fifty opened it, while dragging to reorder worked fine. The cause is an upstream +Kanboard bug: those reorder tables set the drag handle to *every* icon in the row's first cell +(`handle: "td:first i"`), so the gear, its caret and the subtask status checkbox all count as drag +handles. On touch, Kanboard's bundled jQuery UI Touch Punch then treats a tap on them as a drag and +swallows the click. Desktop (mouse) is unaffected. + +- `Asset/js/sortable-handle-fix.js` re-scopes those sortables' `handle` to the real drag icon + (`.draggable-row-handle`), so only the four-arrows drag and the gear/caret/checkbox are plain taps + again -- reordering still works. It re-applies after Kanboard re-renders a table (a debounced + MutationObserver), and only touches sortables whose handle is the buggy `td:first i`, so it is inert + everywhere else. +- **Always on** (no setting) -- it only corrects a broken interaction and does nothing on desktop. + ## Settings Global (per Kanboard instance) and admin-only, under "Settings -> Organon Tweaks", grouped as on diff --git a/VERSION b/VERSION index 8ede066..261780e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -OrganonTweaks v2.2.0 +OrganonTweaks v2.3.0