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

Commit 2b48259

Browse files
dolevdwesleycho
authored andcommitted
fix(dropdown): align position with vertical scrollbar
- Correctly aligns the dropdown when a vertical scrollbar is present Closes #5830 Fixes #4317
1 parent 241fea8 commit 2b48259

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/dropdown/dropdown.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
191191
if (appendTo && self.dropdownMenu) {
192192
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
193193
css,
194-
rightalign;
194+
rightalign,
195+
scrollbarWidth;
195196

196197
css = {
197198
top: pos.top + 'px',
@@ -204,7 +205,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
204205
css.right = 'auto';
205206
} else {
206207
css.left = 'auto';
207-
css.right = window.innerWidth -
208+
scrollbarWidth = $position.scrollbarWidth(true);
209+
css.right = window.innerWidth - scrollbarWidth -
208210
(pos.left + $element.prop('offsetWidth')) + 'px';
209211
}
210212

0 commit comments

Comments
 (0)