Programmatically focus on ion-button

I couldn’t find any solution to setFocus() on ion-button. Focusing ion-input with no problem. But it seems there is no way to focus on ion-button.

setFocus() on ion-button throws error. I want to auto tabindex change when the user press return key on mobile keyboard. I can do this using #a tabindex="1" (keyup.enter)="moveFocus(b)" but if the b is an ion-button it throws error that setFocus is not function for ion-button.

This application is for blind people so they cannot see the button and cannot touch on it, and mobile keyboard has no tab key, it seems the easiest way for navigation on form controls is the enter key on the mobile keyboard. How can I programmatically focus on ion-button when the user touch enter key on ion-input?

2 Likes

When using angular, use a ViewChild on the ion-button, then use the property el to address its nativeElement. On this you can just use focus(). Maybe you need also to add a tabIndex attribute to the ion-button.