Skip to content

Commit

Permalink
Tweak multi-select plain click
Browse files Browse the repository at this point in the history
If there's only one selected row and it's clicked, deselect it
  • Loading branch information
danrahn committed Dec 2, 2023
1 parent edfa9e1 commit 4b39eeb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Client/Script/BulkActionCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,17 @@ class BulkActionTable {
onRowClicked(e, toggledRow) {
// The following should match the behavior of Windows Explorer bulk-selection
if (!e.ctrlKey && !e.shiftKey) {
// If this is the only row that's currently selected, deselect with a plain click.
const onlyThisWasSelected = this.#selected.size === 1 && toggledRow.selected;

// Regular click. Clear out any existing selection and select
// this one, even if it was previously in the group selection.
for (const selectedRow of this.#selected.values()) {
selectedRow.setSelected(false);
}

this.#selected.clear();
this.#setSelectState(toggledRow, true);
this.#setSelectState(toggledRow, !onlyThisWasSelected);
} else if (e.ctrlKey && e.shiftKey) {
if (this.#lastSelected) {
// Iterate from the last selected row to this row. If the last
Expand Down

0 comments on commit 4b39eeb

Please sign in to comment.