Skip to content

Commit

Permalink
DataGrid - Opening an editor with the Enter key is inconsistent when …
Browse files Browse the repository at this point in the history
…scrolling is enabled (T1190668) (#25719)
  • Loading branch information
pomahtri authored Oct 4, 2023
1 parent cf73011 commit 35f15e9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2689,8 +2689,10 @@ export const keyboardNavigationModule: import('../m_types').Module = {
getFocusedCellInRow(rowIndex) {
const keyboardNavigationController = this.getController('keyboardNavigation');
let $cell = this.callBase(rowIndex);
const rowIndexOffset = this._dataController.getRowIndexOffset();
const focusedRowIndex = keyboardNavigationController._focusedCellPosition.rowIndex - rowIndexOffset;

if (keyboardNavigationController.isKeyboardEnabled() && keyboardNavigationController._focusedCellPosition.rowIndex === rowIndex) {
if (keyboardNavigationController.isKeyboardEnabled() && focusedRowIndex === rowIndex) {
const $focusedCell = keyboardNavigationController._getFocusedCell();
if (isElementDefined($focusedCell) && !$focusedCell.hasClass(COMMAND_EDIT_CLASS)) {
$cell = $focusedCell;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import url from '../../../helpers/getPageUrl';
import createWidget from '../../../helpers/createWidget';
import DataGrid from '../../../model/dataGrid';

fixture`Keyboard Navigation - editOnKeyPress`
.page(url(__dirname, '../../container.html'));

const DATA_GRID_SELECTOR = '#container';

test('Editing should start by pressing enter after scrolling content with scrolling.mode=virtual', async (t) => {
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);

await dataGrid.scrollBy({ y: 10000 });

await t.click(dataGrid.getDataCell(49, 1).element);
await t.pressKey('enter');

await t.expect(dataGrid.getDataCell(49, 1).getEditor().element.focused).ok();
}).before(async () => {
await createWidget('dxDataGrid', {
dataSource: [...new Array(50)].map((_, i) => ({
data1: i * 2,
data2: i * 2 + 1,
})),
columns: [
'data1',
'data2',
],
editing: {
allowUpdating: true,
},
scrolling: {
mode: 'virtual',
},
height: 300,
});
});

0 comments on commit 35f15e9

Please sign in to comment.