Ticket [3279221]: Fixed setup of popup menu to prevent immediate
disappearance due to an event race.