Make sure context menus don't go offscreen.