fix popup position flipping
always call setMode callback after the event