Describe the bug
Manually pasting email to username input throws error 'Username cannot be empty'. This bug only on real mobile device on Android. Login form in ionic 4 app.
To Reproduce
Steps to reproduce the behavior:
<amplify-authenticator framework="Ionic"></amplify-authenticator>Expected behavior
User Signed In
Screenshots


Desktop (please complete the following information):
Error only on mobile device
Smartphone (please complete the following information):
Added this work-around to another issue #2537
I struggled with this for WAY too long using Ionic/Angular ... Sharing my final solution ...
@Directive({selector: '[AuthFix]'})
export class AuthFix {
keyupEvent: KeyboardEvent = new KeyboardEvent("keyup");
paste: boolean = false;
@HostListener('paste') onPaste() {
this.paste = true;
}
@HostListener('input', ['$event.target']) onInput(target: any) {
if (this.paste) {
target.parentElement.dispatchEvent(this.keyupEvent);
this.paste = false;
}
}
}
I put AuthFix in my amplify-authenticator tag like so ....
<amplify-authenticator [signUpConfig]="signUpConfig" [usernameAttributes]="usernameAttributes" framework="ionic" AuthFix></amplify-authenticator>
I just ran into the same problem, initially reported by a mobile user, but I was able to reproduce it on a desktop as well. I'm also using core not Ionic version of the component.
l3wy AuthFix solved the problem for me, with one exception, I had to use:
target.dispatchEvent(this.keyupEvent);
instead of
target.parentElement.dispatchEvent(this.keyupEvent);
Most helpful comment
Added this work-around to another issue #2537
I struggled with this for WAY too long using Ionic/Angular ... Sharing my final solution ...
I put AuthFix in my amplify-authenticator tag like so ....
<amplify-authenticator [signUpConfig]="signUpConfig" [usernameAttributes]="usernameAttributes" framework="ionic" AuthFix></amplify-authenticator>