popupmenu stays open until space is pressed again