From cff8cc4ee3e52b6217f14c1cf91fffdc41fcefaf Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Tue, 11 Jun 2024 11:31:30 +0400 Subject: [PATCH] fix --- .../m_keyboard_navigation.ts | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) 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 bdb76a786fed..1acd10f617b2 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 @@ -549,9 +549,11 @@ export class KeyboardNavigationController extends modules.ViewController { } private _closeEditCell() { + const d = Deferred(); setTimeout(() => { - this._editingController.closeEditCell(); + this._editingController.closeEditCell().always(d.resolve); }); + return d; } /** @@ -1055,12 +1057,13 @@ export class KeyboardNavigationController extends modules.ViewController { const allowEditingOnEnterKey = this._allowEditingOnEnterKey(); if (isEditing || (!allowEditingOnEnterKey && direction)) { - this._handleEnterKeyEditingCell(eventArgs.originalEvent); - if (direction === 'next' || direction === 'previous') { - this._targetCellTabHandler(eventArgs, direction); - } else if (direction === 'upArrow' || direction === 'downArrow') { - this._navigateNextCell(eventArgs.originalEvent, direction); - } + this._handleEnterKeyEditingCell(eventArgs.originalEvent).done(() => { + if (direction === 'next' || direction === 'previous') { + this._targetCellTabHandler(eventArgs, direction); + } else if (direction === 'upArrow' || direction === 'downArrow') { + this._navigateNextCell(eventArgs.originalEvent, direction); + } + }); } else if (allowEditingOnEnterKey) { this._startEditing(eventArgs); } @@ -1083,6 +1086,7 @@ export class KeyboardNavigationController extends modules.ViewController { } private _handleEnterKeyEditingCell(event) { + const d = Deferred(); const { target } = event; const $cell = this._getCellElementFromTarget(target); const isRowEditMode = this._isRowEditMode(); @@ -1094,13 +1098,16 @@ export class KeyboardNavigationController extends modules.ViewController { setTimeout( this._editingController.saveEditData.bind(this._editingController), ); + d.resolve(); } else { // @ts-expect-error eventsEngine.trigger($(target), 'change'); - this._closeEditCell(); + // eslint-disable-next-line @typescript-eslint/no-misused-promises + this._closeEditCell().always(d.resolve); event.preventDefault(); } + return d; } /**