prevent first input focus in ionic
Solution 1:
You can use tabindex
attribute to direct the focus. Setting it to -1
will never auto focus.
Solution 2:
Inspired by Github: xclusive36 commented on Nov 27, 2020
To force ion-input to not steal focus, Set ion-button/ion-input with attribute tabIndex="-1",
<ion-item> <ion-input tabindex="-1">foo</ion-input> <ion-button tabindex="-1" >foo</ion-button></ion-item>
As a side effect, the ion-button will take on a border when focused. Add to css to remove the border.
ion-input:focus{ outline: none; }
ion-button:focus{ outline: none; }