mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-29 04:17:41 +02:00
AC-1267 - (1) Mark master pass (MP) field as untouched on any load of MP section of login page post email validation in order to prevent validation errors of "input required" from being shown prematurely before the user has entered anything or lost focus on the input when the user hits enter on the login screen after entering an email (2) Improve the logic around the MP autofocus to match existing code patterns to ensure there are no possible scenarios in which the MP would not be autofocused. (#5246)
This commit is contained in:
parent
1b9c4a9c11
commit
85277aa2f8
@ -246,11 +246,19 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
// so that autofill can work properly
|
||||
this.formGroup.controls.masterPassword.reset();
|
||||
} else {
|
||||
// Mark MP as untouched so that, when users enter email and hit enter,
|
||||
// the MP field doesn't load with validation errors
|
||||
this.formGroup.controls.masterPassword.markAsUntouched();
|
||||
|
||||
// When email is validated, focus on master password after
|
||||
// waiting for input to be rendered
|
||||
this.ngZone.onStable
|
||||
.pipe(take(1))
|
||||
.subscribe(() => this.masterPasswordInput?.nativeElement?.focus());
|
||||
if (this.ngZone.isStable) {
|
||||
this.masterPasswordInput?.nativeElement?.focus();
|
||||
} else {
|
||||
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
||||
this.masterPasswordInput?.nativeElement?.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user