From 2a177aade11ad7ca95e7a0e8bdf168aeb082a9da Mon Sep 17 00:00:00 2001 From: Ilya Surmay Date: Thu, 22 Feb 2018 16:30:52 +0200 Subject: [PATCH] fix(dropdown): fix dropup bs3 position (#3863) --- src/dropdown/bs-dropdown.directive.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dropdown/bs-dropdown.directive.ts b/src/dropdown/bs-dropdown.directive.ts index 13151f3db3..6d6347bda7 100644 --- a/src/dropdown/bs-dropdown.directive.ts +++ b/src/dropdown/bs-dropdown.directive.ts @@ -248,6 +248,7 @@ export class BsDropdownDirective implements OnInit, OnDestroy { if (this._showInline) { this.removeShowClass(); + this.removeDropupStyles(); this._isInlineOpen = false; this.onHidden.emit(true); } else { @@ -281,7 +282,7 @@ export class BsDropdownDirective implements OnInit, OnDestroy { if (!isBs3()) { this.addShowClass(); this.checkRightAlignment(); - this.checkDropup(); + this.addDropupStyles(); } } @@ -315,7 +316,7 @@ export class BsDropdownDirective implements OnInit, OnDestroy { } } - private checkDropup(): void { + private addDropupStyles(): void { if (this._inlinedMenu && this._inlinedMenu.rootNodes[0]) { // a little hack to not break support of bootstrap 4 beta this._renderer.setStyle( @@ -330,4 +331,11 @@ export class BsDropdownDirective implements OnInit, OnDestroy { ); } } + + private removeDropupStyles(): void { + if (this._inlinedMenu && this._inlinedMenu.rootNodes[0]) { + this._renderer.removeStyle(this._inlinedMenu.rootNodes[0], 'top'); + this._renderer.removeStyle(this._inlinedMenu.rootNodes[0], 'transform'); + } + } }