Mixing sync and async event dispatch is error prone.
If one removes a popup from dom (that triggers async hide) and then adds it back and opens the popup, there will be a sync show event, right? And then once the event loop spins, the async hide is dispatched even though the relevant popup is shown.