Compare commits

..

2 Commits

3 changed files with 43 additions and 13 deletions

View File

@ -1 +1 @@
v20260101-08-run-checks-shift-multiselect-persist
v20260101-09-run-checks-shift-multiselect-range-highlight-fix

View File

@ -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;
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) {

View File

@ -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