Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit f838eb6

Browse files
committed
fix(dropdown): align position with or without vertical scrollbar
1 parent 13c14af commit f838eb6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/dropdown/dropdown.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
192192
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
193193
css,
194194
rightalign,
195-
scrollbarWidth;
195+
scrollbarPadding,
196+
scrollbarWidth = 0;
196197

197198
css = {
198199
top: pos.top + 'px',
@@ -205,7 +206,12 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
205206
css.right = 'auto';
206207
} else {
207208
css.left = 'auto';
208-
scrollbarWidth = $position.scrollbarWidth(true);
209+
scrollbarPadding = $position.scrollbarPadding(appendTo);
210+
211+
if (scrollbarPadding.heightOverflow && scrollbarPadding.scrollbarWidth) {
212+
scrollbarWidth = scrollbarPadding.scrollbarWidth;
213+
}
214+
209215
css.right = window.innerWidth - scrollbarWidth -
210216
(pos.left + $element.prop('offsetWidth')) + 'px';
211217
}

0 commit comments

Comments
 (0)