Switch menu to dropup when there is not enough room below

Refs #155 (and countless others). Basically the solution from https://github.com/harvesthq/chosen/issues/155#issuecomment-7467487