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(); } }); }