Do not flip the menu to top if there is not enough space

See https://bugzilla.wikimedia.org/show_bug.cgi?id=49679