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

fix(dropdown): Fix alignment for dropdown-append-to-body with .dropdown-menu-right when there's a vertical scrollbar #5830

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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