Skip to content

Commit 73d39ab

Browse files
Trying to correct an error in the focus implementation
1 parent 3658ad1 commit 73d39ab

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
@@ -75,7 +75,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
7575
/**
7676
* Implemented to manage focus on input
7777
*/
78-
@ViewChild('searchInput') searchInput: ElementRef;
78+
@ViewChild('searchInput') searchInput!: ElementRef;
7979

8080
/**
8181
* The {@link VocabularyOptions} object
@@ -339,7 +339,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
339339
this.storedNodeMap = new Map<string, TreeviewFlatNode>();
340340
this.vocabularyTreeviewService.restoreNodes();
341341
}
342-
this.searchInput.nativeElement.focus();
342+
if (this.searchInput) {
343+
this.searchInput.nativeElement.focus();
344+
}
343345
}
344346

345347
add() {

0 commit comments

Comments
 (0)