From e26b9ee5a6ca044a2d810cf3a04be27d5f310885 Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Tue, 29 Aug 2023 17:49:46 +0200 Subject: [PATCH] Fixed overlay panel (#13480) --- .../components/overlaypanel/overlaypanel.ts | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/app/components/overlaypanel/overlaypanel.ts b/src/app/components/overlaypanel/overlaypanel.ts index 2c8e4b0c288..556eabd25ef 100755 --- a/src/app/components/overlaypanel/overlaypanel.ts +++ b/src/app/components/overlaypanel/overlaypanel.ts @@ -200,7 +200,7 @@ export class OverlayPanel implements AfterContentInit, OnDestroy { private zone: NgZone, public config: PrimeNGConfig, public overlayService: OverlayService - ) {} + ) { } ngAfterContentInit() { this.templates?.forEach((item) => { @@ -225,20 +225,17 @@ export class OverlayPanel implements AfterContentInit, OnDestroy { bindDocumentClickListener() { if (isPlatformBrowser(this.platformId)) { if (!this.documentClickListener && this.dismissable) { - this.zone.runOutsideAngular(() => { - let documentEvent = DomHandler.isIOS() ? 'touchstart' : 'click'; - const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : this.document; - - this.documentClickListener = this.renderer.listen(documentTarget, documentEvent, (event) => { - if (!this.container?.contains(event.target) && this.target !== event.target && !this.target.contains(event.target) && !this.selfClick) { - this.zone.run(() => { - this.hide(); - }); - } - - this.selfClick = false; - this.cd.markForCheck(); - }); + let documentEvent = DomHandler.isIOS() ? 'touchstart' : 'click'; + const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : this.document; + + this.documentClickListener = this.renderer.listen(documentTarget, documentEvent, (event) => { + if (!this.container?.contains(event.target) && !this.target.contains(event.target)) { + this.zone.run(() => { + this.hide(); + }); + } + + this.cd.markForCheck(); }); } } @@ -511,4 +508,4 @@ export class OverlayPanel implements AfterContentInit, OnDestroy { exports: [OverlayPanel, SharedModule], declarations: [OverlayPanel] }) -export class OverlayPanelModule {} +export class OverlayPanelModule { }