File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
projects/igniteui-angular/src/lib/grids/common Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -254,10 +254,13 @@ export class IgxCellCrudState {
254254 // this is needed when we are not using ngModel to update the editValue
255255 // so that the change event of the inlineEditorTemplate is hit before
256256 // trying to update any cell
257- const cellNode = this . grid . gridAPI . get_cell_by_index ( this . cell . id . rowIndex , this . cell . column . field ) . nativeElement ;
258- const document = cellNode . getRootNode ( ) as Document | ShadowRoot ;
259- const activeElement = document . activeElement as HTMLElement ;
260- activeElement . blur ( ) ;
257+ const cellNode = this . grid . gridAPI . get_cell_by_index ( this . cell . id . rowIndex , this . cell . column . field ) ?. nativeElement ;
258+ let activeElement ;
259+ if ( cellNode ) {
260+ const document = cellNode . getRootNode ( ) as Document | ShadowRoot ;
261+ activeElement = document . activeElement as HTMLElement ;
262+ activeElement . blur ( ) ;
263+ }
261264
262265 const formControl = this . grid . validation . getFormControl ( this . cell . id . rowID , this . cell . column . field ) ;
263266 if ( this . grid . validationTrigger === 'blur' && this . cell . pendingValue !== undefined ) {
@@ -285,7 +288,7 @@ export class IgxCellCrudState {
285288 const args = this . cellEdit ( event ) ;
286289 if ( args . cancel ) {
287290 // the focus is needed when we cancel the cellEdit so that the activeElement stays on the editor template
288- activeElement . focus ( ) ;
291+ activeElement ? .focus ( ) ;
289292 return args ;
290293 }
291294
You can’t perform that action at this time.
0 commit comments