Cleaning up ESC and ENTER keys behaviour in dialogs