diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focus.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focus.ts index 4b30c707b9eb..81411e77b62e 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focus.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focus.ts @@ -1,6 +1,7 @@ import DataGrid from 'devextreme-testcafe-models/dataGrid'; import { ClientFunction } from 'testcafe'; import TextBox from 'devextreme-testcafe-models/textBox'; +import { GridsEditMode } from 'devextreme/ui/data_grid'; import { createWidget } from '../../../../helpers/createWidget'; import url from '../../../../helpers/getPageUrl'; @@ -376,3 +377,37 @@ test('Focus method should focus the first data row when focusedRowEnabled = true }, ], })); + +(['batch', 'cell'] as GridsEditMode[]).forEach((editMode) => { + // T1331376 + test(`Tab should focus the next cell after editing a cell by API when focusedRowEnabled (editing.mode=${editMode})`, async (t) => { + const dataGrid = new DataGrid(GRID_SELECTOR); + await t.expect(dataGrid.isReady()).ok(); + + await dataGrid.apiEditCell(0, 0); + + await t + .expect(dataGrid.getDataCell(0, 0).getEditor().element.focused) + .ok(); + + await t.pressKey('tab'); + + await t + .expect(dataGrid.getDataCell(0, 1).isEditCell) + .ok() + .expect(dataGrid.getDataCell(0, 1).getEditor().element.focused) + .ok(); + }).before(async () => createWidget('dxDataGrid', { + dataSource: [ + { ID: 1, FirstName: 'John', LastName: 'Heart' }, + { ID: 2, FirstName: 'Olivia', LastName: 'Peyton' }, + ], + keyExpr: 'ID', + focusedRowEnabled: true, + editing: { + mode: editMode, + allowUpdating: true, + }, + columns: ['FirstName', 'LastName'], + })); +}); diff --git a/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts b/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts index d6cab6e22ac0..7d82f97064db 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts @@ -3081,8 +3081,10 @@ const editing = (Base: ModuleType) => class EditingController } const isCellEditing = super.editCell(rowIndex, columnIndex); + if (isCellEditing) { this._keyboardNavigationController.setupFocusedView(); + this._keyboardNavigationController.setCellFocusType(); } return isCellEditing;