diff --git a/src/directives/toggle/toggle.directive.ts b/src/directives/toggle/toggle.directive.ts index 5e6b8a70c23..949209bf24c 100644 --- a/src/directives/toggle/toggle.directive.ts +++ b/src/directives/toggle/toggle.directive.ts @@ -71,6 +71,9 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { if (!this.collapsed) { return; } const player = this.animationActivation(); + player.onStart(() => { + this.collapsed = false; + }); player.onDone(() => { player.destroy(); if (fireEvents) { @@ -78,7 +81,6 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { } }); - this.collapsed = !this.collapsed; if (fireEvents) { this.onOpening.emit(); } @@ -89,10 +91,8 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { if (this.collapsed) { return; } const player = this.animationActivation(); - player.onStart(() => { - }); player.onDone(() => { - this.collapsed = !this.collapsed; + this.collapsed = true; // When using directive into component with OnPush it is necessary to // trigger change detection again when close animation ends // due to late updated @collapsed property. diff --git a/src/drop-down/drop-down.component.html b/src/drop-down/drop-down.component.html index c2223a93539..bb33bc48788 100644 --- a/src/drop-down/drop-down.component.html +++ b/src/drop-down/drop-down.component.html @@ -1,5 +1,5 @@
-
+
diff --git a/src/drop-down/drop-down.component.ts b/src/drop-down/drop-down.component.ts index 32bb78d97a3..3e0ac639f37 100644 --- a/src/drop-down/drop-down.component.ts +++ b/src/drop-down/drop-down.component.ts @@ -282,6 +282,7 @@ export class IgxDropDownComponent implements IToggleView, OnInit { } onToggleOpening() { + this.toggleDirective.collapsed = false; this.cdr.detectChanges(); this.scrollToItem(this.selectedItem); this.onOpening.emit(); @@ -301,6 +302,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit { this.onOpened.emit(); } + onToggleClosing() { + this.onClosing.emit(); + } + onToggleClosed() { if (this._focusedItem) { this._focusedItem.isFocused = false;