diff --git a/src/wizard.js b/src/wizard.js index 4c9c1ec282..7189a3d595 100644 --- a/src/wizard.js +++ b/src/wizard.js @@ -235,6 +235,14 @@ this.dialog = dialog.modal; this.content = dialog.content; this.footer = dialog.footer; + this.dialog.on('keydown', function(e) { + if (e.which == Sao.common.ESC_KEYCODE) { + e.preventDefault(); + if (this.end_state in this.states) { + this.response(this.end_state); + } + } + }.bind(this)); dialog.body.append(this.widget).append(this.info_bar.el); }, clean: function() { @@ -262,14 +270,6 @@ update: function(view, buttons) { this.content.unbind('submit'); Sao.Wizard.Dialog._super.update.call(this, view, buttons); - this.dialog.on('keydown', function(e) { - if (e.which == Sao.common.ESC_KEYCODE) { - e.preventDefault(); - if (this.end_state in this.states) { - this.response(this.end_state); - } - } - }.bind(this)); this.show(); }, destroy: function(action) {