#1002: Put tooltip/popover on bottom if there is not enough space on top, thanks to @jazzzz