Skip to content

Commit 3517314

Browse files
committed
fix(dropdown): align position with or without vertical scrollbar (angular-ui/bootstrap#5942)
Relates to #5942, #5943
1 parent 5d53287 commit 3517314

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ui-bootstrap-tpls.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,10 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
32313231
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
32323232
css,
32333233
rightalign,
3234-
scrollbarWidth;
3234+
// <#5942> https://github.com/angular-ui/bootstrap/issues/5942
3235+
scrollbarPadding,
3236+
scrollbarWidth = 0;
3237+
// </5942>
32353238

32363239
css = {
32373240
top: pos.top + 'px',
@@ -3244,7 +3247,13 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
32443247
css.right = 'auto';
32453248
} else {
32463249
css.left = 'auto';
3247-
scrollbarWidth = $position.scrollbarWidth(true);
3250+
// <#5942> https://github.com/angular-ui/bootstrap/issues/5942
3251+
scrollbarPadding = $position.scrollbarPadding(appendTo);
3252+
3253+
if (scrollbarPadding.heightOverflow && scrollbarPadding.scrollbarWidth) {
3254+
scrollbarWidth = scrollbarPadding.scrollbarWidth;
3255+
}
3256+
// </5942>
32483257
css.right = window.innerWidth - scrollbarWidth -
32493258
(pos.left + $element.prop('offsetWidth')) + 'px';
32503259
}

0 commit comments

Comments
 (0)