MCPcopy Create free account
hub / github.com/UI5/webcomponents / _onkeydown

Method _onkeydown

packages/main/src/TableSelectionMulti.ts:196–220  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

194 }
195
196 _onkeydown(e: KeyboardEvent) {
197 if (!this._table || !e.shiftKey) {
198 return;
199 }
200
201 const focusedElement = getActiveElement(); // Assumption: The focused element is always the "next" row after navigation.
202
203 if (!(focusedElement?.hasAttribute("ui5-table-row") || this._rangeSelection?.isMouse)) {
204 this._stopRangeSelection();
205 return;
206 }
207
208 if (!this._rangeSelection) {
209 // If no range selection is active, start one
210 const row = focusedElement as TableRow;
211 this._startRangeSelection(row, this.isSelected(row));
212 } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
213 const change = isUpShift(e) ? -1 : 1;
214 this._handleRangeSelection(focusedElement as TableRow, change);
215 }
216
217 if (this._rangeSelection) {
218 this._rangeSelection.shiftPressed = e.shiftKey;
219 }
220 }
221
222 _onkeyup(e: KeyboardEvent, eventOrigin: HTMLElement) {
223 if (!this._table) {

Callers

nothing calls this directly

Calls 7

_stopRangeSelectionMethod · 0.95
_startRangeSelectionMethod · 0.95
isSelectedMethod · 0.95
_handleRangeSelectionMethod · 0.95
getActiveElementFunction · 0.85
isUpShiftFunction · 0.85
hasAttributeMethod · 0.80

Tested by

no test coverage detected