fix(routing): make rule drag-and-drop work on mobile cards
Some checks are pending
CI / go-test (push) Waiting to run
CI / govulncheck (push) Waiting to run
CI / frontend (push) Waiting to run
CodeQL Advanced / Analyze (go) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run

The pointermove handler looked up the drop target via
el.closest('tr[data-row-key]'). That selector only matches the
desktop a-table rows; the mobile branch renders each rule as a
<div class="rule-card" data-row-key>, so on phones the lookup
always returned null, dropTargetIndex stayed pinned to the start
index, and the eventual drop was a no-op. Loosened the selector
to [data-row-key] so both DOM shapes resolve.
This commit is contained in:
MHSanaei 2026-05-14 02:04:05 +02:00
parent 194de8869e
commit 21058eb63c
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A

View file

@ -188,9 +188,9 @@ function onDragPointerMove(ev) {
dragMoved = true; dragMoved = true;
const el = document.elementFromPoint(ev.clientX, ev.clientY); const el = document.elementFromPoint(ev.clientX, ev.clientY);
if (!el) return; if (!el) return;
const tr = el.closest('tr[data-row-key]'); const target = el.closest('[data-row-key]');
if (!tr) return; if (!target) return;
const idx = Number(tr.getAttribute('data-row-key')); const idx = Number(target.getAttribute('data-row-key'));
if (Number.isFinite(idx)) dropTargetIndex.value = idx; if (Number.isFinite(idx)) dropTargetIndex.value = idx;
} }