From 58e036e43ded6bcf26c25b7cbb2ead4cfc8c4c36 Mon Sep 17 00:00:00 2001 From: Sunil Shah Date: Sun, 9 Aug 2026 14:40:24 -0400 Subject: [PATCH 1/7] drag to reorder behavior for ranking questions in ranking.js --- inst/js/ranking.js | 135 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 inst/js/ranking.js diff --git a/inst/js/ranking.js b/inst/js/ranking.js new file mode 100644 index 00000000..288c03b7 --- /dev/null +++ b/inst/js/ranking.js @@ -0,0 +1,135 @@ +// Drag to reorder behavior for ranking questions +// Use Pointer Events so mouse and touch run through one code path. +// (The native HTML 5 drag and drop API is not usable here: it does not fire on touch devices.) +// Handlers are registered ONCE on the document and work for every current and future ranking question, +// including reactive questions that re-render -- the same delegated approach used in interaction.js. + +(function () { + var dragging = null; // the
  • currently being dragged + var draggingList = null; //its parent