Hm, we should probably simply reause some code here? Have one type of event modification for any dialog, and then check only for this. There is no need for differentiating between dialogs of different type. You just deactivate all dialogs on click and escape key.