diff --git a/packages/grid/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx b/packages/grid/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx index 23271938dbeec..3f1b86f5e42ab 100644 --- a/packages/grid/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx +++ b/packages/grid/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx @@ -734,6 +734,16 @@ describe(' - Cell Editing', () => { fireEvent.keyDown(cell, { key: '$' }); expect(listener.lastCall.args[0].reason).to.equal('printableKeyDown'); }); + + it(`should not publish 'cellEditStart' if space is pressed`, () => { + render(); + const listener = spy(); + apiRef.current.subscribeEvent('cellEditStart', listener); + const cell = getCell(0, 1); + userEvent.mousePress(cell); + fireEvent.keyDown(cell, { key: ' ' }); + expect(listener.callCount).to.equal(0); + }); }); describe('by pressing a number', () => { diff --git a/packages/grid/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx b/packages/grid/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx index 17002f57d955d..bdb80e2666ee2 100644 --- a/packages/grid/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx +++ b/packages/grid/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx @@ -879,6 +879,16 @@ describe(' - Row Editing', () => { expect(listener.callCount).to.equal(1); }); + it('should not call startRowEditMode if space is pressed', () => { + render(); + const listener = spy(); + apiRef.current.subscribeEvent('rowEditStart', listener); + const cell = getCell(0, 1); + userEvent.mousePress(cell); + fireEvent.keyDown(cell, { key: ' ' }); + expect(listener.callCount).to.equal(0); + }); + it(`should call startRowEditMode if ctrl+V is pressed`, () => { render(); const listener = spy(); diff --git a/packages/grid/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts b/packages/grid/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts index 63fd807b0a743..a823f5a5c06e5 100644 --- a/packages/grid/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts +++ b/packages/grid/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts @@ -157,8 +157,8 @@ export const useGridCellEditing = ( } else if (params.isEditable) { let reason: GridCellEditStartReasons | undefined; - if (event.key === ' ' && event.shiftKey) { - return; // Shift + Space is used to select the row + if (event.key === ' ') { + return; // Space scrolls to the last row } if (isPrintableKey(event)) { diff --git a/packages/grid/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts b/packages/grid/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts index 402f89fabf25d..279847ef9d65f 100644 --- a/packages/grid/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts +++ b/packages/grid/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts @@ -225,8 +225,8 @@ export const useGridRowEditing = ( } else if (params.isEditable) { let reason: GridRowEditStartReasons | undefined; - if (event.key === ' ' && event.shiftKey) { - return; // Shift + Space is used to select the row + if (event.key === ' ') { + return; // Space scrolls to the last row } if (isPrintableKey(event)) {