I am using angular 1 and md-autocomplete
<md-autocomplete
md-autofocus="true"
md-autoselect="true"
md-select-on-match="false"
md-search-text-change="$ctrl.searchTextChange($ctrl.searchText)"
md-search-text="$ctrl.searchText"
md-items="item in $ctrl.performQuery($ctrl.searchText)"
md-item-text="item.name"
md-no-cache="true"
md-min-length="0"
placeholder="{{'core.common.filter.results' | translate}}"
md-selected-item-change="$ctrl.onItemChange()"
ng-readonly="$ctrl.isReadOnly">
Here how my autocomplete is defined
setFocus(){
setTimeout(() => {
this.$element.find('md-autocomplete').find('input').focus()
},0)
}
From another method I call setFocus()
func
for desktop and android everything works correctly. Both necessary functionality are called: autocomplete selectors and keyboard(for mobile)
I also debugged and found that correct input is focused
but the problem is that focus on input does not call keyboard on ios every time, it can happen randomly. in this time autocomplete suggestions are shown every time
also tried to use querySelectorAll
and querySelector
the same problem
document.querySelectorAll('md-autocomplete > md-autocomplete-wrap > input')[0].focus()