From d4d4937502e107d70d26dafc40d0b79df9975721 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Fri, 6 Mar 2026 16:42:34 +0800 Subject: [PATCH 01/11] fix --- .../grid_core/keyboard_navigation/m_keyboard_navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fbb694f5e8bb..aabaf02bc2f1 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 @@ -238,7 +238,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo const isCell = $element.is('td'); const needSetFocusPosition = (this.option('focusedRowIndex') ?? -1) < 0; - if (isCell && needSetFocusPosition) { + if (isCell && needSetFocusPosition && isRelatedTargetInRowsView) { this._updateFocusedCellPosition($element); } } From 3b83b1f79759e7ff19ce1ccb06df3e0188d17ca2 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Fri, 6 Mar 2026 18:23:38 +0800 Subject: [PATCH 02/11] Revert "fix" This reverts commit e288738e6fd865d2b5baf9347f24c510dfdfcdd2. --- .../grid_core/keyboard_navigation/m_keyboard_navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 aabaf02bc2f1..fbb694f5e8bb 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 @@ -238,7 +238,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo const isCell = $element.is('td'); const needSetFocusPosition = (this.option('focusedRowIndex') ?? -1) < 0; - if (isCell && needSetFocusPosition && isRelatedTargetInRowsView) { + if (isCell && needSetFocusPosition) { this._updateFocusedCellPosition($element); } } From b72cbd940fab227cb726240bb5944788470a7190 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Fri, 6 Mar 2026 18:24:06 +0800 Subject: [PATCH 03/11] fix2 --- .../grid_core/keyboard_navigation/m_keyboard_navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fbb694f5e8bb..2d47e947d01a 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 @@ -239,7 +239,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo const isCell = $element.is('td'); const needSetFocusPosition = (this.option('focusedRowIndex') ?? -1) < 0; if (isCell && needSetFocusPosition) { - this._updateFocusedCellPosition($element); + super._updateFocusedCellPosition($element); } } From d270688b830a15c6804d65525bbbdecfbc2e2974 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Wed, 11 Mar 2026 19:12:01 +0800 Subject: [PATCH 04/11] Revert "fix2" This reverts commit 36428f2f828321673e5d4c6fbf5de74d805714c9. --- .../grid_core/keyboard_navigation/m_keyboard_navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2d47e947d01a..fbb694f5e8bb 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 @@ -239,7 +239,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo const isCell = $element.is('td'); const needSetFocusPosition = (this.option('focusedRowIndex') ?? -1) < 0; if (isCell && needSetFocusPosition) { - super._updateFocusedCellPosition($element); + this._updateFocusedCellPosition($element); } } From 9fec0b530705265ce545ab58f84c3e57348606a8 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Wed, 11 Mar 2026 20:01:32 +0800 Subject: [PATCH 05/11] fix parameter --- .../grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts | 1 + 1 file changed, 1 insertion(+) 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 fbb694f5e8bb..ac4bfc7fb4e0 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 @@ -239,6 +239,7 @@ export class KeyboardNavigationController extends KeyboardNavigationControllerCo const isCell = $element.is('td'); const needSetFocusPosition = (this.option('focusedRowIndex') ?? -1) < 0; if (isCell && needSetFocusPosition) { + this._focusView(); this._updateFocusedCellPosition($element); } } From 7152bce3c5307b29cdb98a6a7cf2f977aa7c975b Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 15:58:48 +0800 Subject: [PATCH 06/11] qunit --- .../focus.tests.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js index bcdd7e4db956..9cef4046e2e6 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js @@ -3314,6 +3314,41 @@ QUnit.module('Focused row', getModuleConfig(true), () => { assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count'); }); + QUnit.testInActiveWindow('T1282664', function(assert) { + // arrange + const that = this; + let focusedCellChangedCount = 0; + this.data = [ + { id: 1, text: 'item 1' }, + { id: 2, text: 'item 2' }, + ]; + this.options = { + keyExpr: 'id', + columns: ['id', 'text'], + onFocusedCellChanged: function(e) { + ++focusedCellChangedCount; + + // assert + assert.deepEqual($(e.cellElement).text(), $(that.getCellElement(0, 0)).text(), 'Cell element'); + assert.deepEqual(e.columnIndex, 0, 'Column index'); + assert.deepEqual(e.row.data, { id: 1, text: 'item 1' }, 'Row data'); + assert.deepEqual(e.rowIndex, 0, 'Row index'); + } + }; + + this.setupModule(); + + this.gridView.render($('#container')); + this.clock.tick(10); + + // act + const columnHeadersView = this.gridView.getView('columnHeadersView'); + this.triggerKeyDown('tab', false, false, columnHeadersView.getHeaderElement(1)); + + // assert + assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count'); + }); + // T755462 QUnit.testInActiveWindow('The page with focused row should load without errors after sorting the boolean column', function(assert) { // arrange From b4240b1ba34984ca9bd03534d0781085f35ceaa1 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 16:26:52 +0800 Subject: [PATCH 07/11] qunit title --- .../testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js index 9cef4046e2e6..0b489530cb50 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js @@ -3314,7 +3314,7 @@ QUnit.module('Focused row', getModuleConfig(true), () => { assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count'); }); - QUnit.testInActiveWindow('T1282664', function(assert) { + QUnit.testInActiveWindow('onFocusedCellChanged row and cellElement parameter should be defined for the first cell (T1282664)', function(assert) { // arrange const that = this; let focusedCellChangedCount = 0; From 67469f8c095973a5f15d3db2eacd63cf43f3209c Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 18:02:26 +0800 Subject: [PATCH 08/11] revert qunit --- .../focus.tests.js | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js index 0b489530cb50..bcdd7e4db956 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js @@ -3314,41 +3314,6 @@ QUnit.module('Focused row', getModuleConfig(true), () => { assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count'); }); - QUnit.testInActiveWindow('onFocusedCellChanged row and cellElement parameter should be defined for the first cell (T1282664)', function(assert) { - // arrange - const that = this; - let focusedCellChangedCount = 0; - this.data = [ - { id: 1, text: 'item 1' }, - { id: 2, text: 'item 2' }, - ]; - this.options = { - keyExpr: 'id', - columns: ['id', 'text'], - onFocusedCellChanged: function(e) { - ++focusedCellChangedCount; - - // assert - assert.deepEqual($(e.cellElement).text(), $(that.getCellElement(0, 0)).text(), 'Cell element'); - assert.deepEqual(e.columnIndex, 0, 'Column index'); - assert.deepEqual(e.row.data, { id: 1, text: 'item 1' }, 'Row data'); - assert.deepEqual(e.rowIndex, 0, 'Row index'); - } - }; - - this.setupModule(); - - this.gridView.render($('#container')); - this.clock.tick(10); - - // act - const columnHeadersView = this.gridView.getView('columnHeadersView'); - this.triggerKeyDown('tab', false, false, columnHeadersView.getHeaderElement(1)); - - // assert - assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count'); - }); - // T755462 QUnit.testInActiveWindow('The page with focused row should load without errors after sorting the boolean column', function(assert) { // arrange From 663ee4d960d4202e982763d0db01b1e6cbd468aa Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 19:02:44 +0800 Subject: [PATCH 09/11] testcafe --- .../keyboardNavigation.functional.ts | 47 +++++++++++++++++++ .../tests/dataGrid/helpers/eventUtils.ts | 21 +++++++++ 2 files changed, 68 insertions(+) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts index a49aea8c31aa..7cb51334f3be 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts @@ -4149,6 +4149,53 @@ test('DataGrid - focusedRowIndex is -1 when the first data cell is focused with }, })); +test('DataGrid - onFocusedCellChanged parameters should be correct when focusing the first cell (T1175896)', async (t) => { + const dataGrid = new DataGrid('#container'); + + // act + await t + .click(dataGrid.getSearchBox().input) + .pressKey('tab tab tab'); + + // assert + const firstDataCell = dataGrid.getDataCell(0, 0).element; + await t + .expect(firstDataCell.focused) + .ok() + + const expectedFocusedCellChangedEventArgs = { + cellElement: firstDataCell, + columnIndex: 0, + row: { + data: { + field_0: 'val_0_0', + field_1: 'val_0_1', + }, + }, + rowIndex: 0, + }; + await checkFocusedCellChangedEventArgs(t, expectedFocusedCellChangedEventArgs); +}).before(async () => { + await resetFocusedEventsTestData(); + + await createWidget('dxDataGrid', { + dataSource: getData(1, 2), + keyExpr: 'field_0', + showBorders: true, + searchPanel: { + visible: true, + }, + onFocusedCellChanged(e) { + (window as any).focusedEventsTestData.push({ name: 'onFocusedCellChanged', args: e }); + }, + }) +}) +.after(async () => { + await ClientFunction(() => { + delete (window as any).focusedEventsTestData; + })(); +}); + test('DataGrid - Cell focus in edit mode does not work correctly if a cell has a disabled editor (T1177434)', async (t) => { const dataGrid = new DataGrid('#container'); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/helpers/eventUtils.ts b/e2e/testcafe-devextreme/tests/dataGrid/helpers/eventUtils.ts index 074d7613b0cc..174d3eae7b43 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/helpers/eventUtils.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/helpers/eventUtils.ts @@ -35,7 +35,11 @@ const getFocusedCellChangedEventArgs = ClientFunction( .args; return { + cellElementText: eventArgs.cellElement.get(0).textContent, columnIndex: eventArgs.columnIndex, + row: { + data: eventArgs.row.data, + }, rowIndex: eventArgs.rowIndex, }; }, @@ -102,7 +106,11 @@ export const checkFocusedRowChangingEventArgs = async ( export const checkFocusedCellChangedEventArgs = async ( t: TestController, expectedArgs: { + cellElement?: Selector; columnIndex: number; + row?: { + data: any; + }; rowIndex: number; }, ): Promise => { @@ -113,6 +121,19 @@ export const checkFocusedCellChangedEventArgs = async ( .eql(expectedArgs.columnIndex) .expect(args.rowIndex) .eql(expectedArgs.rowIndex); + + if (expectedArgs.row?.data) { + await t + .expect(args.row.data) + .eql(expectedArgs.row.data); + } + + if (expectedArgs.cellElement) { + const expectedCellElementText = await expectedArgs.cellElement.textContent; + await t + .expect(args.cellElementText) + .eql(expectedCellElementText); + } }; export const checkFocusedRowChangedEventArgs = async ( From f28f127ecb51e7f2c0032d1a0d9855fa15e865b9 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 19:20:16 +0800 Subject: [PATCH 10/11] testcafe fixes --- .../keyboardNavigation/keyboardNavigation.functional.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts index 7cb51334f3be..254c0e866bb2 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts @@ -4149,7 +4149,7 @@ test('DataGrid - focusedRowIndex is -1 when the first data cell is focused with }, })); -test('DataGrid - onFocusedCellChanged parameters should be correct when focusing the first cell (T1175896)', async (t) => { +test('DataGrid - onFocusedCellChanged parameters should be correct when focusing the first cell (T1282664)', async (t) => { const dataGrid = new DataGrid('#container'); // act @@ -4161,7 +4161,7 @@ test('DataGrid - onFocusedCellChanged parameters should be correct when focusing const firstDataCell = dataGrid.getDataCell(0, 0).element; await t .expect(firstDataCell.focused) - .ok() + .ok(); const expectedFocusedCellChangedEventArgs = { cellElement: firstDataCell, @@ -4188,7 +4188,7 @@ test('DataGrid - onFocusedCellChanged parameters should be correct when focusing onFocusedCellChanged(e) { (window as any).focusedEventsTestData.push({ name: 'onFocusedCellChanged', args: e }); }, - }) + }); }) .after(async () => { await ClientFunction(() => { From 1b8dc9f47aee581b659ad43bcaa2afb5fd76f4d5 Mon Sep 17 00:00:00 2001 From: Mark Allen Ramirez Date: Mon, 16 Mar 2026 19:46:38 +0800 Subject: [PATCH 11/11] testcafe lint --- .../common/keyboardNavigation/keyboardNavigation.functional.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts index 254c0e866bb2..ab481999f56a 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts @@ -4189,8 +4189,7 @@ test('DataGrid - onFocusedCellChanged parameters should be correct when focusing (window as any).focusedEventsTestData.push({ name: 'onFocusedCellChanged', args: e }); }, }); -}) -.after(async () => { +}).after(async () => { await ClientFunction(() => { delete (window as any).focusedEventsTestData; })();