1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

remove static element ref

This commit is contained in:
rr-bw
2024-09-12 13:29:11 -07:00
parent 6ffaeae331
commit bb5f88f8c7
2 changed files with 17 additions and 39 deletions

View File

@@ -67,7 +67,7 @@ export enum LoginUiState {
],
})
export class LoginComponentV2 implements OnInit, OnDestroy {
@ViewChild("masterPasswordInput", { static: true }) masterPasswordInput: ElementRef;
@ViewChild("masterPasswordInputRef") masterPasswordInputRef: ElementRef;
@Input() captchaSiteKey: string = null;
private destroy$ = new Subject<void>();
@@ -360,10 +360,10 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
// When email is validated, focus on master password after waiting for input to be rendered
if (this.ngZone.isStable) {
this.masterPasswordInput?.nativeElement?.focus();
this.masterPasswordInputRef?.nativeElement?.focus();
} else {
this.ngZone.onStable.pipe(take(1), takeUntil(this.destroy$)).subscribe(() => {
this.masterPasswordInput?.nativeElement?.focus();
this.masterPasswordInputRef?.nativeElement?.focus();
});
}
}