Skip to content

Commit a8ff6a4

Browse files
Andrea-Guevaratdonohue
authored andcommitted
Trying to correct an error in the focus implementation
1 parent 75260b0 commit a8ff6a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
3232
/**
3333
* Implemented to manage focus on input
3434
*/
35-
@ViewChild('searchInput') searchInput: ElementRef;
35+
@ViewChild('searchInput') searchInput!: ElementRef;
3636

3737
/**
3838
* The {@link VocabularyOptions} object
@@ -299,7 +299,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
299299
this.storedNodeMap = new Map<string, TreeviewFlatNode>();
300300
this.vocabularyTreeviewService.restoreNodes();
301301
}
302-
this.searchInput.nativeElement.focus();
302+
if (this.searchInput) {
303+
this.searchInput.nativeElement.focus();
304+
}
303305
}
304306

305307
add() {

0 commit comments

Comments
 (0)