From 241d00ff9903996ea1a86cef090943221791615e Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Thu, 1 Jan 2026 17:23:31 +0100 Subject: [PATCH] Auto-commit local changes before build (2026-01-01 17:23:31) --- .last-branch | 2 +- .../src/templates/main/run_checks.html | 45 ++++++++++++++----- docs/changelog.md | 9 ++++ 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/.last-branch b/.last-branch index 2b5807b..11b078b 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260101-08-run-checks-shift-multiselect-persist +v20260101-09-run-checks-shift-multiselect-range-highlight-fix diff --git a/containers/backupchecks/src/templates/main/run_checks.html b/containers/backupchecks/src/templates/main/run_checks.html index 675be3c..c908039 100644 --- a/containers/backupchecks/src/templates/main/run_checks.html +++ b/containers/backupchecks/src/templates/main/run_checks.html @@ -351,8 +351,19 @@ function statusClass(status) { return ids.filter(function (x) { return Number.isFinite(x); }); } + function refreshRowHighlights() { + var cbs = table.querySelectorAll('tbody .rc_row_cb'); + cbs.forEach(function (cb) { + var tr = cb.closest ? cb.closest('tr') : null; + if (!tr) return; + if (cb.checked) tr.classList.add('table-active'); + else tr.classList.remove('table-active'); + }); + } + function updateButtons() { var ids = getSelectedJobIds(); + refreshRowHighlights(); if (btnMark) btnMark.disabled = ids.length === 0; if (btnUnmark) btnUnmark.disabled = ids.length === 0; if (statusEl) statusEl.textContent = ids.length ? (ids.length + ' selected') : ''; @@ -382,10 +393,11 @@ table.addEventListener('mousedown', function (e) { var t = e.target; if (!t) return; - if (t.classList && t.classList.contains('rc_row_cb')) { + var cb = (t.classList && t.classList.contains('rc_row_cb')) ? t : (t.closest ? t.closest('.rc_row_cb') : null); + if (cb) { // Remember state before click so Shift-click logic can reliably compute the intended target state - lastMouseDownCb = t; - lastMouseDownChecked = t.checked; + lastMouseDownCb = cb; + lastMouseDownChecked = cb.checked; if (e.shiftKey) { e.preventDefault(); @@ -399,7 +411,10 @@ table.addEventListener('mousedown', function (e) { // Handle Shift-click range selection on the checkbox inputs (delegated) table.addEventListener('click', function (e) { var t = e.target; - if (!t || !(t.classList && t.classList.contains('rc_row_cb'))) return; + if (!t) return; + var cb = (t.classList && t.classList.contains('rc_row_cb')) ? t : (t.closest ? t.closest('.rc_row_cb') : null); + if (!cb) return; + t = cb; // Custom handling so we can reliably read shiftKey and control the toggle + range if (e.shiftKey && lastCheckedCb && lastCheckedCb !== t) { @@ -416,15 +431,19 @@ table.addEventListener('click', function (e) { lastMouseDownCb = null; lastMouseDownChecked = null; - var cbs = Array.prototype.slice.call(table.querySelectorAll('tbody .rc_row_cb')); - var start = cbs.indexOf(lastCheckedCb); - var end = cbs.indexOf(t); + var rows = Array.prototype.slice.call(table.querySelectorAll('tbody tr')); + var startRow = lastCheckedCb.closest ? lastCheckedCb.closest('tr') : null; + var endRow = t.closest ? t.closest('tr') : null; + + var start = startRow ? rows.indexOf(startRow) : -1; + var end = endRow ? rows.indexOf(endRow) : -1; if (start !== -1 && end !== -1) { var lo = Math.min(start, end); var hi = Math.max(start, end); for (var i = lo; i <= hi; i++) { - cbs[i].checked = targetChecked; + var cb = rows[i].querySelector('.rc_row_cb'); + if (cb) cb.checked = targetChecked; } } @@ -451,10 +470,12 @@ table.addEventListener('click', function (e) { // Fallback for keyboard toggles (space) and other state changes table.addEventListener('change', function (e) { - if (e.target && e.target.classList && e.target.classList.contains('rc_row_cb')) { - lastCheckedCb = e.target; - updateButtons(); - } + var t = e.target; + if (!t) return; + var cb = (t.classList && t.classList.contains('rc_row_cb')) ? t : (t.closest ? t.closest('.rc_row_cb') : null); + if (!cb) return; + lastCheckedCb = cb; + updateButtons(); }); function postJson(url, body) { diff --git a/docs/changelog.md b/docs/changelog.md index 48c9412..217e263 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -158,6 +158,15 @@ - Fixed Shift-click multi-select on the Run Checks page so the initial checkbox selection is preserved when selecting additional rows with Shift. - Made Shift range selection use the checkbox pre-click state to prevent unintended double-toggles across browsers. +--- + +## v20260101-09-run-checks-shift-multiselect-range-highlight-fix + +### Changed +- Fixed shift-click multi-select behavior on the Run Checks page to include the clicked row in the selection range. +- Corrected an off-by-one issue where selection previously stopped one row above the clicked item. +- Added visual highlighting for all rows that are selected via checkmarks to clearly indicate active selection. + ================================================================================================================================================ ## v0.1.14