diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts index 2602cfd75e..5695644040 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts @@ -32,7 +32,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges /** * Implemented to manage focus on input */ - @ViewChild('searchInput') searchInput: ElementRef; + @ViewChild('searchInput') searchInput!: ElementRef; /** * The {@link VocabularyOptions} object @@ -299,7 +299,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges this.storedNodeMap = new Map(); this.vocabularyTreeviewService.restoreNodes(); } - this.searchInput.nativeElement.focus(); + if (this.searchInput) { + this.searchInput.nativeElement.focus(); + } } add() {