dropdownToggle detects when dropdown runs off the visible viewport and inverts the dropdown direction from left to right in such case. The problem is that this detection does not work under certain circumstances as demonstrated in this codepen: http://codepen.io/romario333/pen/EjgMLM
The rersult is this (direction is not reversed and dropdown is cut off in the middle):
This is caused by a bug in the following code:
var left = Math.round(offset.left - parentOffset.left);
var rightThreshold = $window.innerWidth - dropdownWidth - 8;
if (left > rightThreshold) {
Note that left is relative to the closest positioned parent while rightThreshold is relative to the viewport - these are not always the same. This PR fixes this by adjusting rightThreshold to be relative to the same reference point as left. (Demo of the fix is here)
dropdownToggle
detects when dropdown runs off the visible viewport and inverts the dropdown direction from left to right in such case. The problem is that this detection does not work under certain circumstances as demonstrated in this codepen: http://codepen.io/romario333/pen/EjgMLMThe rersult is this (direction is not reversed and dropdown is cut off in the middle):
This is caused by a bug in the following code:
Note that
left
is relative to the closest positioned parent whilerightThreshold
is relative to the viewport - these are not always the same. This PR fixes this by adjustingrightThreshold
to be relative to the same reference point asleft
. (Demo of the fix is here)