I have two element on the page:
<input tabindex="0" type="text" (keydown)="keydownInputSearch($event)" (click)="showSearchResultContent = !showSearchResultContent" #inputSearch>
And block:
<div #searchList class="SearchList" *ngIf="showSearchResult()" tabindex="-1"></div>
Problem is when block #searchLis
is exist I can not set focus back to #inputSearch
.
I have tried:
this.inputSearch.nativeElement.focus();
No errors, no effect. I suppose problem is that #searchList
has tabindex="-1"
and #inputSearch
has less: tabindex="0"
.
But by defaul input should have focus automatically.