From 664fb78deee20df7f70d05e0e35c944529b7bae6 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 10 Aug 2021 16:09:44 +0300 Subject: [PATCH] Fixed #10491 --- src/app/components/styleclass/styleclass.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/components/styleclass/styleclass.ts b/src/app/components/styleclass/styleclass.ts index cf1e357bcc7..330f1468ed8 100644 --- a/src/app/components/styleclass/styleclass.ts +++ b/src/app/components/styleclass/styleclass.ts @@ -133,6 +133,10 @@ export class StyleClass implements AfterViewInit, OnDestroy { DomHandler.addClass(this.target, this.leaveToClass); } } + + if (this.hideOnOutsideClick) { + this.unbindDocumentListener(); + } } resolveTarget() { @@ -166,7 +170,6 @@ export class StyleClass implements AfterViewInit, OnDestroy { } else if (!this.el.nativeElement.isSameNode(event.target) && !this.el.nativeElement.contains(event.target) && !this.target.contains(event.target)) { this.leave(); - this.unbindDocumentListener(); } }); }