File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
projects/igniteui-angular/src/lib/grids/common Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,16 @@ export class IgxCellCrudState {
225225 if ( ! this . cell ) {
226226 return ;
227227 }
228+ // this is needed when we are not using ngModel to update the editValue
229+ // so that the change event of the inlineEditorTemplate is hit before
230+ // trying to update any cell
231+ const cellNode = this . grid . gridAPI . get_cell_by_index ( this . cell . id . rowIndex , this . cell . column . field ) ?. nativeElement ;
232+ let activeElement ;
233+ if ( cellNode ) {
234+ const document = cellNode . getRootNode ( ) as Document | ShadowRoot ;
235+ activeElement = document . activeElement as HTMLElement ;
236+ activeElement . blur ( ) ;
237+ }
228238
229239 const formControl = this . grid . validation . getFormControl ( this . cell . id . rowID , this . cell . column . field ) ;
230240 if ( this . grid . validationTrigger === 'blur' && this . cell . pendingValue !== undefined ) {
@@ -251,6 +261,8 @@ export class IgxCellCrudState {
251261
252262 const args = this . cellEdit ( event ) ;
253263 if ( args . cancel ) {
264+ // the focus is needed when we cancel the cellEdit so that the activeElement stays on the editor template
265+ activeElement ?. focus ( ) ;
254266 return args ;
255267 }
256268
You can’t perform that action at this time.
0 commit comments