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

Fix modal overlay click handling by only listening on self-clicks

Benjamin Bädorfb43e6e57b6f1
diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.html b/frontend/src/app/shared/components/modal/modal-overlay.component.html
index 70fd959d7c5..d2dad8f3a55 100644
--- a/frontend/src/app/shared/components/modal/modal-overlay.component.html
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.html
@@ -8,12 +8,12 @@
tabindex="0"
cdkFocusInitial
cdkTrapFocus
- (click)="close()"
+ (click)="close($event, false)"
>
<button
type="button"
class="spot-button spot-modal-overlay--close-button"
- (click)="close()"
+ (click)="close($event)"
>
<span class="spot-icon spot-icon_close"></span>
</button>
diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.ts b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
index 089ff215a7a..99f18f4d11a 100644
--- a/frontend/src/app/shared/components/modal/modal-overlay.component.ts
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
@@ -115,7 +115,10 @@ export class OpModalOverlayComponent implements OnInit {
});
}
- public close():void {
+ public close($event:MouseEvent, includeChildClicks = true):void {
+ if (!includeChildClicks && $event.currentTarget !== $event.target) {
+ return;
+ }
this.modalService.close();
}
}