diff --git a/src/app/components/overlaypanel/overlaypanel.ts b/src/app/components/overlaypanel/overlaypanel.ts
index dc54dc80eac..1ba6a8c2bb7 100755
--- a/src/app/components/overlaypanel/overlaypanel.ts
+++ b/src/app/components/overlaypanel/overlaypanel.ts
@@ -47,7 +47,7 @@ import { Subscription } from 'rxjs';
role="dialog"
[attr.aria-modal]="overlayVisible"
>
-
+
@@ -229,10 +229,11 @@ export class OverlayPanel implements AfterContentInit, OnDestroy {
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)) {
+ if (!this.container?.contains(event.target) && !this.target.contains(event.target) && this.target !== event.target && !this.selfClick) {
this.hide();
}
+ this.selfClick = false;
this.cd.markForCheck();
});
}
@@ -297,8 +298,9 @@ export class OverlayPanel implements AfterContentInit, OnDestroy {
this.selfClick = true;
}
- onContentClick() {
- this.selfClick = true;
+ onContentClick(event: MouseEvent) {
+ const targetElement = event.target as HTMLElement;
+ this.selfClick = event.offsetX < targetElement.clientWidth && event.offsetY < targetElement.clientHeight;
}
hasTargetChanged(event: any, target: any) {