Ensure contextmenu stays within window bounds