Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fixes to build

Benjamin Bädorfa8153d526fb0
diff --git a/frontend/src/app/shared/components/grids/widgets/add/add.modal.html b/frontend/src/app/shared/components/grids/widgets/add/add.modal.html
index 6f7848e3d60..1273f255313 100644
--- a/frontend/src/app/shared/components/grids/widgets/add/add.modal.html
+++ b/frontend/src/app/shared/components/grids/widgets/add/add.modal.html
@@ -1,9 +1,5 @@
<div
class="spot-modal loading-indicator--location"
- tabindex="0"
- cdkFocusInitial
- cdkTrapFocus
- [cdkTrapFocusAutoCapture]="true"
data-indicator-name="modal"
>
<div class="spot-modal--header">{{text.title}}</div>
diff --git a/frontend/src/app/shared/components/modal/modal-portal.component.html b/frontend/src/app/shared/components/modal/modal-overlay.component.html
similarity index 83%
rename from frontend/src/app/shared/components/modal/modal-portal.component.html
rename to frontend/src/app/shared/components/modal/modal-overlay.component.html
index ca4dda29521..224a0a759c6 100644
--- a/frontend/src/app/shared/components/modal/modal-portal.component.html
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.html
@@ -4,6 +4,10 @@
'spot-modal-overlay_active': isActive,
'spot-modal-overlay_not-full-screen': notFullscreen
}"
+ tabindex="0"
+ cdkFocusInitial
+ cdkTrapFocus
+ [cdkTrapFocusAutoCapture]="true"
(click)="close()"
>
<button
diff --git a/frontend/src/app/shared/components/modal/modal-portal.component.ts b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
similarity index 62%
rename from frontend/src/app/shared/components/modal/modal-portal.component.ts
rename to frontend/src/app/shared/components/modal/modal-overlay.component.ts
index 6a42b59f502..a4bf5f3f940 100644
--- a/frontend/src/app/shared/components/modal/modal-portal.component.ts
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
@@ -30,14 +30,19 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild,
} from '@angular/core';
+import {
+ ComponentPortal,
+ ComponentType,
+ PortalInjector,
+} from '@angular/cdk/portal';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
@Component({
- templateUrl: './modal-portal.component.html',
+ templateUrl: './modal-overlay.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class OpModalPortalComponent implements OnInit {
+export class OpModalOverlayComponent implements OnInit {
// override superclass
// Allowing outside clicks to close the modal leads to the user involuntarily closing
// the modal when removing error messages or clicking on labels e.g. in the registration modal.
@@ -45,6 +50,8 @@ export class OpModalPortalComponent implements OnInit {
@ViewChild('portalOutlet') portalOutlet: ElementRef<HTMLElement>;
+ modalPortal$ = this.modalService.activeModal$;
+
constructor(
readonly modalService:OpModalService,
readonly elementRef:ElementRef,
@@ -53,7 +60,38 @@ export class OpModalPortalComponent implements OnInit {
) { }
ngOnInit():void {
+ // onclose:
+ // this.active.closingEvent.emit(this.active);
+ // onopen:
+ // this.active.onOpen();
+
+ const portal = new ComponentPortal(modal, null, this.injectorFor(injector, locals));
+
+ setTimeout(() => {
+ // Focus on the first element
+ this.active && this.active.onOpen();
+
+ // Mark that we've opened the modal now
+ this.opening = false;
+
+ // Trigger another round of change detection in the modal
+ ref.changeDetectorRef.detectChanges();
+ }, 20);
}
- modalPortal$ = this.modalService.activeModal$;
+ /**
+ * Create an augmented injector that is equal to this service's injector + the additional data
+ * passed into +show+.
+ * This allows callers to pass data into the newly created modal.
+ */
+ private injectorFor(injector:Injector, data:Record<string, unknown>) {
+ const injectorTokens = new WeakMap();
+ // Pass the service because otherwise we're getting a cyclic dependency between the portal
+ // host service and the bound portal
+ data.service = this;
+
+ injectorTokens.set(OpModalLocalsToken, data);
+
+ return new PortalInjector(injector, injectorTokens);
+ }
}
diff --git a/frontend/src/app/shared/components/modal/modal.service.ts b/frontend/src/app/shared/components/modal/modal.service.ts
index e6861e3c938..5220515c9b3 100644
--- a/frontend/src/app/shared/components/modal/modal.service.ts
+++ b/frontend/src/app/shared/components/modal/modal.service.ts
@@ -99,26 +99,6 @@ export class OpModalService {
if (injector === 'global') {
injector = this.injector;
}
-
- // Create a portal for the given component class and render it
- const portal = new ComponentPortal(modal, null, this.injectorFor(injector, locals));
-
- setTimeout(() => {
- // Focus on the first element
- this.active && this.active.onOpen();
-
- // Mark that we've opened the modal now
- this.opening = false;
-
- // Trigger another round of change detection in the modal
- ref.changeDetectorRef.detectChanges();
- }, 20);
-
- return this.active as T;
- }
-
- public isActive(modal:OpModalComponent):boolean {
- return this.active !== null && this.active === modal;
}
/**
@@ -137,20 +117,4 @@ export class OpModalService {
}
*/
}
-
- /**
- * Create an augmented injector that is equal to this service's injector + the additional data
- * passed into +show+.
- * This allows callers to pass data into the newly created modal.
- */
- private injectorFor(injector:Injector, data:Record<string, unknown>) {
- const injectorTokens = new WeakMap();
- // Pass the service because otherwise we're getting a cyclic dependency between the portal
- // host service and the bound portal
- data.service = this;
-
- injectorTokens.set(OpModalLocalsToken, data);
-
- return new PortalInjector(injector, injectorTokens);
- }
}