From 44165fba585ee6ff72bf99ab6eb7af5c578b8c51 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Mon, 15 Jul 2019 13:28:51 +0200 Subject: [PATCH] Better fix for modal. --- .../app/framework/angular/modals/modal.directive.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Squidex/app/framework/angular/modals/modal.directive.ts b/src/Squidex/app/framework/angular/modals/modal.directive.ts index 1c8c81152..78e57052d 100644 --- a/src/Squidex/app/framework/angular/modals/modal.directive.ts +++ b/src/Squidex/app/framework/angular/modals/modal.directive.ts @@ -122,13 +122,11 @@ export class ModalDirective implements OnDestroy { private subscribeToView() { if (this.closeAuto) { - this.eventsView.own(timer(500).subscribe(() => { - document.addEventListener('click', this.documentClickListener, true); + document.addEventListener('mousedown', this.documentClickListener, true); - this.eventsView.own(() => { - document.removeEventListener('click', this.documentClickListener, true); - }); - })); + this.eventsView.own(() => { + document.removeEventListener('mousedown', this.documentClickListener, true); + }); } if (this.closeAlways && this.renderRoots) {