Compare commits
No commits in common. "15befc0b3210a008ecfefa03265c15f80b10b15b" and "8c40ad46783740f55cedb895d61d069ce6f590cf" have entirely different histories.
15befc0b32
...
8c40ad4678
@ -1 +1 @@
|
||||
v20260101-13-run-checks-select-all-indeterminate-state-fix
|
||||
v20260101-12-run-checks-select-all-indeterminate-clear-selection-fix
|
||||
|
||||
@ -381,57 +381,57 @@ function statusClass(status) {
|
||||
}
|
||||
|
||||
if (selectAll) {
|
||||
function setAllSelection(checked) {
|
||||
function clearAllSelection() {
|
||||
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
||||
cbs.forEach(function (cb) { cb.checked = !!checked; });
|
||||
|
||||
// Keep header checkbox state in sync and avoid a "stuck" indeterminate UI.
|
||||
cbs.forEach(function (cb) { cb.checked = false; });
|
||||
// Ensure header checkbox is reset as well.
|
||||
selectAll.indeterminate = false;
|
||||
selectAll.checked = !!checked;
|
||||
|
||||
selectAll.checked = false;
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
function toggleHeaderSelection(e) {
|
||||
if (e) {
|
||||
// When the header checkbox is indeterminate (partial selection), users expect a click
|
||||
// to clear the selection, not to select everything.
|
||||
var selectAllWasIndeterminate = false;
|
||||
|
||||
selectAll.addEventListener('mousedown', function () {
|
||||
selectAllWasIndeterminate = !!selectAll.indeterminate;
|
||||
}, true);
|
||||
|
||||
selectAll.addEventListener('click', function (e) {
|
||||
if (selectAllWasIndeterminate) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
clearAllSelection();
|
||||
selectAllWasIndeterminate = false;
|
||||
}
|
||||
}, true);
|
||||
|
||||
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
||||
var total = cbs.length;
|
||||
if (!total) {
|
||||
// No rows; always reset header state.
|
||||
selectAll.indeterminate = false;
|
||||
selectAll.checked = false;
|
||||
updateButtons();
|
||||
selectAll.addEventListener('keydown', function (e) {
|
||||
// Space toggles checkboxes. If indeterminate, treat Space as "clear selection".
|
||||
if ((e.key === ' ' || e.code === 'Space') && selectAll.indeterminate) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
clearAllSelection();
|
||||
}
|
||||
}, true);
|
||||
|
||||
selectAll.addEventListener('change', function () {
|
||||
// Safety net: if any browser still fires change after an indeterminate click,
|
||||
// force the expected "clear" behavior.
|
||||
if (selectAllWasIndeterminate) {
|
||||
clearAllSelection();
|
||||
selectAllWasIndeterminate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var checked = 0;
|
||||
cbs.forEach(function (cb) { if (cb.checked) checked++; });
|
||||
|
||||
// Behavior:
|
||||
// - none selected => select all
|
||||
// - all selected => clear all
|
||||
// - partial selection (indeterminate) => clear selection
|
||||
var target = (checked === 0);
|
||||
|
||||
setAllSelection(target);
|
||||
}
|
||||
|
||||
// Fully control header checkbox behavior to prevent indeterminate state from getting stuck.
|
||||
selectAll.addEventListener('click', toggleHeaderSelection, true);
|
||||
|
||||
selectAll.addEventListener('keydown', function (e) {
|
||||
// Space/Enter should behave the same as a click.
|
||||
if (e.key === ' ' || e.code === 'Space' || e.key === 'Enter') {
|
||||
toggleHeaderSelection(e);
|
||||
}
|
||||
}, true);
|
||||
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
||||
cbs.forEach(function (cb) { cb.checked = selectAll.checked; });
|
||||
updateButtons();
|
||||
});
|
||||
}
|
||||
|
||||
// Prevent browser text selection when using Shift with checkbox selection
|
||||
// Prevent browser text selection when using Shift with checkbox selection
|
||||
table.addEventListener('mousedown', function (e) {
|
||||
var t = e.target;
|
||||
if (!t) return;
|
||||
|
||||
@ -192,15 +192,6 @@
|
||||
- Implemented click interception before the browser toggles the checkbox state to prevent unintended full selection from the indeterminate state.
|
||||
- Added consistent keyboard behavior: pressing Space on the indeterminate header checkbox now also clears the selection.
|
||||
|
||||
---
|
||||
|
||||
## v20260101-13-run-checks-select-all-indeterminate-state-fix
|
||||
|
||||
- Fixed the “Select all” checkbox behavior on the Run Checks page.
|
||||
- Resolved an issue where the checkbox remained in the indeterminate (`-`) state after clearing the selection.
|
||||
- Ensured that after clearing all selected rows, the “Select all” checkbox can again be used to select all rows normally.
|
||||
- Improved synchronization between individual row selection and the global “Select all” checkbox state.
|
||||
|
||||
================================================================================================================================================
|
||||
## v0.1.14
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user