From f838eb649ed59364fa7c19f4448e6e6ecae9f7f9 Mon Sep 17 00:00:00 2001 From: Dolev Dori Date: Wed, 25 May 2016 02:51:04 +0300 Subject: [PATCH] fix(dropdown): align position with or without vertical scrollbar --- src/dropdown/dropdown.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dropdown/dropdown.js b/src/dropdown/dropdown.js index 78644af28d..5c967f3361 100644 --- a/src/dropdown/dropdown.js +++ b/src/dropdown/dropdown.js @@ -192,7 +192,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position']) var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true), css, rightalign, - scrollbarWidth; + scrollbarPadding, + scrollbarWidth = 0; css = { top: pos.top + 'px', @@ -205,7 +206,12 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position']) css.right = 'auto'; } else { css.left = 'auto'; - scrollbarWidth = $position.scrollbarWidth(true); + scrollbarPadding = $position.scrollbarPadding(appendTo); + + if (scrollbarPadding.heightOverflow && scrollbarPadding.scrollbarWidth) { + scrollbarWidth = scrollbarPadding.scrollbarWidth; + } + css.right = window.innerWidth - scrollbarWidth - (pos.left + $element.prop('offsetWidth')) + 'px'; }