Skip to content

Commit

Permalink
fix(ui5-table): range selection should stop when releasing shift (#9710)
Browse files Browse the repository at this point in the history
Instead of using isShift(), use event.shiftKey instead, as isShift just checks the released key.
  • Loading branch information
DonkeyCo authored Aug 20, 2024
1 parent 20fd09c commit 7894823
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/main/src/TableSelection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
isUpShift,
isShift,
} from "@ui5/webcomponents-base/dist/Keys.js";
import getActiveElement from "@ui5/webcomponents-base/dist/util/getActiveElement.js";
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
Expand Down Expand Up @@ -252,11 +251,9 @@ class TableSelection extends UI5Element implements ITableFeature {
return;
}

if (!eventOrigin.hasAttribute("ui5-table-row") || !this._rangeSelection || !isShift(e)) {
// Stop range selection if a) Shift is relased or b) the event target is not a row or c) the event is not from the selection checkbox
if (isSelectionCheckbox(e)) {
this._stopRangeSelection();
}
if (!eventOrigin.hasAttribute("ui5-table-row") || !this._rangeSelection || !e.shiftKey) {
// Stop range selection if a) Shift is relased or b) the event target is not a row
this._stopRangeSelection();
}

if (this._rangeSelection) {
Expand Down

0 comments on commit 7894823

Please sign in to comment.