Compare commits
2 Commits
8c40ad4678
...
15befc0b32
| Author | SHA1 | Date | |
|---|---|---|---|
| 15befc0b32 | |||
| 3bd99523c3 |
@ -1 +1 @@
|
|||||||
v20260101-12-run-checks-select-all-indeterminate-clear-selection-fix
|
v20260101-13-run-checks-select-all-indeterminate-state-fix
|
||||||
|
|||||||
@ -381,54 +381,54 @@ function statusClass(status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
function clearAllSelection() {
|
function setAllSelection(checked) {
|
||||||
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
||||||
cbs.forEach(function (cb) { cb.checked = false; });
|
cbs.forEach(function (cb) { cb.checked = !!checked; });
|
||||||
// Ensure header checkbox is reset as well.
|
|
||||||
|
// Keep header checkbox state in sync and avoid a "stuck" indeterminate UI.
|
||||||
|
selectAll.indeterminate = false;
|
||||||
|
selectAll.checked = !!checked;
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleHeaderSelection(e) {
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
||||||
|
var total = cbs.length;
|
||||||
|
if (!total) {
|
||||||
|
// No rows; always reset header state.
|
||||||
selectAll.indeterminate = false;
|
selectAll.indeterminate = false;
|
||||||
selectAll.checked = false;
|
selectAll.checked = false;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cbs = table.querySelectorAll('tbody .rc_row_cb');
|
var checked = 0;
|
||||||
cbs.forEach(function (cb) { cb.checked = selectAll.checked; });
|
cbs.forEach(function (cb) { if (cb.checked) checked++; });
|
||||||
updateButtons();
|
|
||||||
});
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent browser text selection when using Shift with checkbox selection
|
// Prevent browser text selection when using Shift with checkbox selection
|
||||||
|
|||||||
@ -192,6 +192,15 @@
|
|||||||
- Implemented click interception before the browser toggles the checkbox state to prevent unintended full selection from the indeterminate state.
|
- 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.
|
- 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
|
## v0.1.14
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user