diff --git a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts index 64ff302709dd..998d184db813 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts @@ -469,15 +469,18 @@ export const focusModule = { this.option('focusedColumnIndex', columnIndex); }, - _escapeKeyHandler(eventArgs, isEditing) { + _escapeKeyHandler(eventArgs, isEditing): boolean { if (isEditing || !this.option('focusedRowEnabled')) { - this.callBase(eventArgs, isEditing); - return; + return this.callBase(eventArgs, isEditing); } if (this.isCellFocusType()) { this.setRowFocusType(); this._focus(this._getCellElementFromTarget(eventArgs.originalEvent.target), true); + + return true; } + + return false; }, _updateFocusedCellPosition($cell, direction) { 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 5981cc9d5829..fcc003333977 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 @@ -472,8 +472,7 @@ export class KeyboardNavigationController extends modules.ViewController { break; case 'escape': - this._escapeKeyHandler(e, isEditing); - isHandled = true; + isHandled = this._escapeKeyHandler(e, isEditing); break; case 'F': @@ -1060,7 +1059,7 @@ export class KeyboardNavigationController extends modules.ViewController { } } - _escapeKeyHandler(eventArgs, isEditing) { + _escapeKeyHandler(eventArgs, isEditing): boolean { const $cell = this._getCellElementFromTarget( eventArgs.originalEvent.target, ); @@ -1081,7 +1080,11 @@ export class KeyboardNavigationController extends modules.ViewController { } } eventArgs.originalEvent.preventDefault(); + + return true; } + + return false; } _ctrlFKeyHandler(eventArgs) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js index e9c229c35a1f..2081b2aeff91 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js @@ -2064,6 +2064,24 @@ QUnit.module('Keyboard keys', { assert.ok(!this.editingController.hasEditData(), 'grid hasn\'t unsaved data'); }); + // T1202731 + QUnit.testInActiveWindow('Escape should bubble up when any grid action was not executed', function(assert) { + // arrange + const $container = $('#container'); + + setupModules(this); + + this.gridView.render($container); + this.focusFirstCell(); + + const e = $.Event('keydown', { key: 'escape' }); + $($container.find('.dx-datagrid-rowsview')).trigger(e); + this.clock.tick(10); + + // assert + assert.ok(!e.isPropagationStopped(), 'propagation is not stopped'); + }); + QUnit.testInActiveWindow('Editing by enter key is not worked when editing is disabled', function(assert) { // arrange const $container = $('#container');