Skip to content

Commit 4579192

Browse files
authored
DataGrid - Focused cell appearance is applied to non-editable CheckBox cells on mouse clicks (DevExpress#30922)
1 parent e363608 commit 4579192

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

e2e/testcafe-devextreme/tests/dataGrid/common/focus/focus.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,22 @@ test('DataGrid - FocusedRowChanged event isnt raised when the push API is used t
298298
},
299299
}));
300300
});
301+
302+
test('DataGrid - Focused cell appearance is applied to non-editable CheckBox cells on mouse clicks (T1282082)', async (t) => {
303+
const grid = new DataGrid(GRID_SELECTOR);
304+
305+
await t
306+
.click(grid.getDataCell(0, 0).element)
307+
.click(grid.getDataCell(0, 1).element)
308+
.click(grid.getDataCell(0, 0).element)
309+
.expect(grid.getDataCell(0, 0).isFocused)
310+
.notOk();
311+
}).before(async () => createWidget('dxDataGrid', {
312+
dataSource: [
313+
{ BoolOne: false, BoolTwo: false },
314+
],
315+
columns: [
316+
'BoolOne',
317+
'BoolTwo',
318+
],
319+
}));

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,7 @@ export class KeyboardNavigationController extends modules.ViewController {
13631363
private _clickTargetCellHandler(event, $cell) {
13641364
const column = this._getColumnByCellElement($cell);
13651365
const isCellEditMode = this._isCellEditMode();
1366+
const isEditing = this._editingController.isEditing();
13661367

13671368
this.setCellFocusType();
13681369

@@ -1397,14 +1398,18 @@ export class KeyboardNavigationController extends modules.ViewController {
13971398
const $target = event
13981399
&& $(event.target).closest(`${NON_FOCUSABLE_ELEMENTS_SELECTOR}, td`);
13991400
const skipFocusEvent = $target && $target.not($cell).is(NON_FOCUSABLE_ELEMENTS_SELECTOR);
1400-
const isEditor = !!column && !column.command && $cell.hasClass(EDITOR_CELL_CLASS);
1401-
const isDisabled = !isEditor && (!args.isHighlighted || skipFocusEvent);
1401+
const isEditCell = !column?.command
1402+
&& isEditing
1403+
&& $cell.hasClass(EDITOR_CELL_CLASS);
1404+
1405+
const isDisabled = !isEditCell
1406+
&& (!args.isHighlighted || skipFocusEvent);
14021407
this._focus($cell, isDisabled, skipFocusEvent);
14031408
}
14041409
} else {
14051410
this.setRowFocusType();
14061411
this.setFocusedRowIndex(args.prevRowIndex);
1407-
if (this._editingController.isEditing() && isCellEditMode) {
1412+
if (isEditing && isCellEditMode) {
14081413
this._closeEditCell();
14091414
}
14101415
}

0 commit comments

Comments
 (0)