Skip to content

Commit 0a5745d

Browse files
author
Alyar
committed
Fix copilot comment
1 parent 3ebd70c commit 0a5745d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo
10781078
const $event: KeyboardEvent = eventArgs.originalEvent;
10791079
let eventTarget = $event.target as Element;
10801080
let elementType: NavigationElementType = this._getElementType(eventTarget);
1081-
let $cell: dxElementWrapper = this._getCellElementFromTarget(eventTarget);
1081+
let $cell: dxElementWrapper | undefined = this._getCellElementFromTarget(eventTarget);
10821082

10831083
// Non-editor cells with intermediate interactive elements use native tab
10841084
if (!isEditorCell(this, $cell) && this.isOriginalTabHandlerRequired($cell, eventArgs)) {
@@ -1097,14 +1097,13 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo
10971097
({ target: eventTarget, elementType } = this._ensureCellFocusType(eventTarget, elementType));
10981098

10991099
const nextCellInfo = this._getNextCellByTabKey($event, direction, elementType);
1100-
$cell = nextCellInfo.$cell!;
11011100

1102-
if (!$cell) {
1101+
if (!nextCellInfo.$cell) {
11031102
return false;
11041103
}
11051104

11061105
// Handle row transition — fires focusedRowChanging event
1107-
$cell = this._checkNewLineTransition($event, $cell)!;
1106+
$cell = this._checkNewLineTransition($event, nextCellInfo.$cell);
11081107

11091108
if (!$cell) {
11101109
return false;
@@ -1186,12 +1185,15 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo
11861185
if (rowIndex !== this._getRowIndex($row)) {
11871186
const cellPosition = this._getCellPosition($cell);
11881187
const args = this._fireFocusedRowChanging($event, $row);
1188+
11891189
if (args.cancel) {
11901190
return;
11911191
}
1192+
11921193
if (args.rowIndexChanged && cellPosition) {
11931194
this.setFocusedColumnIndex(cellPosition.columnIndex);
1194-
$cell = this._getFocusedCell();
1195+
1196+
return this._getFocusedCell();
11951197
}
11961198
}
11971199

@@ -2833,16 +2835,15 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo
28332835
return $element.length && $element[0].tagName === 'TD';
28342836
}
28352837

2836-
public _getCellElementFromTarget(target) {
2838+
public _getCellElementFromTarget(target: Element): dxElementWrapper {
28372839
const elementType = this._getElementType(target);
28382840
const $targetElement = $(target);
2839-
let $cell;
2841+
28402842
if (elementType === 'cell') {
2841-
$cell = $targetElement.closest(`.${ROW_CLASS} > td`);
2842-
} else {
2843-
$cell = $targetElement.children().not(`.${COMMAND_EXPAND_CLASS}`).first();
2843+
return $targetElement.closest(`.${ROW_CLASS} > td`);
28442844
}
2845-
return $cell;
2845+
2846+
return $targetElement.children().not(`.${COMMAND_EXPAND_CLASS}`).first();
28462847
}
28472848

28482849
private _getRowsViewElement() {

0 commit comments

Comments
 (0)