Closed WayneDanielSinclair closed 5 years ago
This should be supported as there are no wrapper around this ionic element. It should be same as using it in plain JS, I'll give it a try and report back
@WayneDanielSinclair From the test that I did it indeed does not set focus when called from mounted
but I believe this to be a browser issue as it works just fine when called via a click handler or any other user interaction.
Actually scratch that, it does work with a timeout as per this: https://github.com/ionic-team/ionic/issues/17745
mounted() {
setTimeout(() => this.$refs.searchbar.setFocus(), 1)
}
Ok thanks for looking into that.
I am trying to set the focus on an ion-searchbar. I would expect the above to work. https://ionicframework.com/docs/api/searchbar#methods Am I missing something or is this not supported?
I have tried working around it by trying to call the native focus function on the actual input element that is created but have not had success getting the input from the children of the ion-searchbar