fix(list): toggle a checkbox in place instead of rebuilding the grid
renderGrid replaces every card, so the scroll container jumped back to the top: ticking a card near the bottom of a long list threw the user back to the first row. Only the affected card and the selection bar are updated now.
This commit is contained in:
@@ -3573,7 +3573,23 @@ let selectionAnchor = null; // last single-clicked card, used for shift+click r
|
||||
function toggleChecked(id) {
|
||||
if (state.checked.has(id)) state.checked.delete(id);
|
||||
else state.checked.add(id);
|
||||
renderGrid();
|
||||
// In place, not renderGrid(): rebuilding the grid replaces every card, and
|
||||
// the scroll container jumps back to the top — ticking a card near the
|
||||
// bottom of a long list threw the user back to the first row.
|
||||
const on = state.checked.has(id);
|
||||
document.querySelectorAll(
|
||||
'.entry-card[data-id="' + id + '"], .entry-row[data-id="' + id + '"]'
|
||||
).forEach(node => {
|
||||
node.classList.toggle('is-checked', on);
|
||||
const box = node.querySelector('.entry-check');
|
||||
if (!box) return;
|
||||
box.classList.toggle('is-checked', on);
|
||||
box.title = on ? 'Deselect' : 'Select';
|
||||
// The tick is a child element added at render time, not CSS content.
|
||||
box.textContent = '';
|
||||
if (on) box.appendChild(el('span', null, '✓'));
|
||||
});
|
||||
renderBatchBar();
|
||||
}
|
||||
|
||||
function handleCardClick(ev, entry, inTrash) {
|
||||
|
||||
Reference in New Issue
Block a user