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

Commit

Permalink
fix(dropdown): align position with vertical scrollbar
Browse files Browse the repository at this point in the history
- Correctly aligns the dropdown when a vertical scrollbar is present

Closes #5830
Fixes #4317
  • Loading branch information
dolevd authored and wesleycho committed Apr 20, 2016
1 parent 241fea8 commit 2b48259
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
if (appendTo && self.dropdownMenu) {
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
css,
rightalign;
rightalign,
scrollbarWidth;

css = {
top: pos.top + 'px',
Expand All @@ -204,7 +205,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
css.right = 'auto';
} else {
css.left = 'auto';
css.right = window.innerWidth -
scrollbarWidth = $position.scrollbarWidth(true);
css.right = window.innerWidth - scrollbarWidth -
(pos.left + $element.prop('offsetWidth')) + 'px';
}

Expand Down

0 comments on commit 2b48259

Please sign in to comment.