diff --git a/angular/src/components/login.component.ts b/angular/src/components/login.component.ts index 61b66c56..22c9736a 100644 --- a/angular/src/components/login.component.ts +++ b/angular/src/components/login.component.ts @@ -58,8 +58,8 @@ export class LoginComponent implements OnInit { if (this.rememberEmail == null) { this.rememberEmail = true; } - if (Utils.isBrowser) { - document.getElementById(this.email == null || this.email === '' ? 'email' : 'masterPassword').focus(); + if (Utils.isBrowser && !Utils.isNode) { + this.focusInput(); } } @@ -143,4 +143,8 @@ export class LoginComponent implements OnInit { '&redirectUri=' + encodeURIComponent(ssoRedirectUri) + '&state=' + state + '&codeChallenge=' + codeChallenge); } + + protected focusInput() { + document.getElementById(this.email == null || this.email === '' ? 'email' : 'masterPassword').focus(); + } } diff --git a/electron/src/window.main.ts b/electron/src/window.main.ts index b8a42aea..a7c542bb 100644 --- a/electron/src/window.main.ts +++ b/electron/src/window.main.ts @@ -174,6 +174,12 @@ export class WindowMain { this.win.on('move', () => { this.windowStateChangeHandler(Keys.mainWindowSize, this.win); }); + this.win.on('focus', () => { + this.win.webContents.send('messagingService', { + command: 'windowIsFocused', + windowIsFocused: true, + }); + }); if (this.createWindowCallback) { this.createWindowCallback(this.win);