Menus always drop down if not enough room to drop up

Discovered an issue where a menu with lots of items would "drop up"
instead of drop down if it was too tall to fit entirely inside the
viewport. This is a problem if the menu is also too tall to be fully
visible in the "up" position. A browser will automatically grow the
document, allowing the user to scroll down, if the menu goes off the
bottom of the page. But if it extends off the top of the page, you
cannot access the missing portion at all.

This change makes it so menus only drop up if there is room in the
viewport to see the entire thing.
Merge branch 'fix-pop-up-behavior'