Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri committed Jun 14, 2024
1 parent eaa3962 commit cff8cc4
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit cff8cc4

Please sign in to comment.