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 {
254
254
// this is needed when we are not using ngModel to update the editValue
255
255
// so that the change event of the inlineEditorTemplate is hit before
256
256
// 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
+ }
261
264
262
265
const formControl = this . grid . validation . getFormControl ( this . cell . id . rowID , this . cell . column . field ) ;
263
266
if ( this . grid . validationTrigger === 'blur' && this . cell . pendingValue !== undefined ) {
@@ -285,7 +288,7 @@ export class IgxCellCrudState {
285
288
const args = this . cellEdit ( event ) ;
286
289
if ( args . cancel ) {
287
290
// the focus is needed when we cancel the cellEdit so that the activeElement stays on the editor template
288
- activeElement . focus ( ) ;
291
+ activeElement ? .focus ( ) ;
289
292
return args ;
290
293
}
291
294
You can’t perform that action at this time.
0 commit comments