Skip to content

Commit

Permalink
Make sure dropdowns don't go above the edge of the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed Nov 5, 2017
1 parent 257ee93 commit 3be98b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/lib/components/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export default class Dropdown extends Component {
$menu.offset().top + $menu.height() > $(window).scrollTop() + $(window).height()
);

if ($menu.offset().top < 0) {
$menu.removeClass('Dropdown-menu--top');
}

$menu.toggleClass(
'Dropdown-menu--right',
isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width()
Expand Down

0 comments on commit 3be98b9

Please sign in to comment.