Set focus to another input when first loses focus


#1

I have two inputs on my screen and I need to lose the focus of the first one (ionBlur) the second has focus.

This code works in parts, when I lose the focus of the first input the second gets focus (the ionFocus event is fired on it), but I can not type anything in the input.

Note: I’m not developing an app, so the problem is not with the keyboard plugin.

Note 2: The focus is initially set to the first input (username) through the “this.username.setFocus ()” method. The focus is being set and I can populate the field normally, and so does focus focus on the password field when loading the page. But it does not work in conjunction with event “(ionBlur)”

<form (ngSubmit)="autenticar()">
            <ion-item>
              <ion-label position="floating">Usuário</ion-label>
              <ion-input #username type="text" [(ngModel)]="credenciais.username" name="username" (ionBlur)="senha.setFocus()"></ion-input>
            </ion-item>
            <ion-item>
              <ion-label position="floating">Senha</ion-label>
              <ion-input #senha type="password" clearOnEdit="false" clearInput="true" [(ngModel)]="credenciais.senha" name="senha" 
                        (keyup.enter)="autenticar()"></ion-input>
            </ion-item>
            <!-- <ion-button size="default" expand="block" (click)='autenticar()' class="botaoLogar" type="submit">Entrar</ion-button> -->
            <ion-button size="default" expand="block" class="botaoLogar" type="submit">Entrar</ion-button>
          </form>