diff --git a/src/app/core/guards/login.guard.ts b/src/app/core/guards/login.guard.ts
index 1e6a3d31f7..fcdd2ec073 100644
--- a/src/app/core/guards/login.guard.ts
+++ b/src/app/core/guards/login.guard.ts
@@ -38,6 +38,7 @@ export class LoginGuard implements CanActivate {
const loginModalComponent = this.currentDialog.componentInstance as LoginModalComponent;
loginModalComponent.loginMessageKey = route.queryParamMap.get('messageKey');
+ loginModalComponent.detectChanges();
// dialog closed
loginModalComponent.closeModal.pipe(first()).subscribe(() => {
diff --git a/src/app/shared/components/login/login-modal/login-modal.component.html b/src/app/shared/components/login/login-modal/login-modal.component.html
index 28116b1a05..5755e4bae4 100644
--- a/src/app/shared/components/login/login-modal/login-modal.component.html
+++ b/src/app/shared/components/login/login-modal/login-modal.component.html
@@ -7,6 +7,7 @@
{{ 'account.login.signin.heading' | translate }}
[title]="'dialog.close.text' | translate"
[attr.aria-label]="'dialog.close.text' | translate"
(click)="hide()"
+ ngbAutofocus
>
×
diff --git a/src/app/shared/components/login/login-modal/login-modal.component.ts b/src/app/shared/components/login/login-modal/login-modal.component.ts
index a0030c2e1a..0f9cd4bb53 100644
--- a/src/app/shared/components/login/login-modal/login-modal.component.ts
+++ b/src/app/shared/components/login/login-modal/login-modal.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'ish-login-modal',
@@ -9,6 +9,12 @@ export class LoginModalComponent {
@Input() loginMessageKey: string;
@Output() closeModal = new EventEmitter();
+ constructor(private cdRef: ChangeDetectorRef) {}
+
+ detectChanges() {
+ this.cdRef.detectChanges();
+ }
+
hide() {
this.closeModal.emit();
}