From 9682cd5f2620da0c3e475a58482407e28bd1302c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sun, 5 Nov 2017 16:17:50 +1030 Subject: [PATCH] Make sure dropdowns don't go above the edge of the screen --- framework/core/js/lib/components/Dropdown.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/core/js/lib/components/Dropdown.js b/framework/core/js/lib/components/Dropdown.js index 8093ba506..d3fa8ae3f 100644 --- a/framework/core/js/lib/components/Dropdown.js +++ b/framework/core/js/lib/components/Dropdown.js @@ -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()