Skip to content

Commit 22f9ac8

Browse files
committed
Fix #44 keyboard handler for modal
1 parent 2232c13 commit 22f9ac8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

client/views/dialogs/base.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ define([
3737
this.$el.addClass(this.options.className);
3838

3939
this.value = null;
40+
this.keydownHandler = _.bind(this.keydown, this)
4041

42+
// Bind keyboard
4143
if (this.options.keyboard) {
42-
$(document).keydown(_.bind(this.keydown, this));
44+
$(document).bind("keydown", this.keydownHandler);
4345
}
4446

4547
return this;
@@ -69,6 +71,11 @@ define([
6971
if (e != null) {
7072
e.preventDefault();
7173
}
74+
75+
// Unbind dowument keydown
76+
$(document).unbind("keydown", this.keydownHandler);
77+
78+
// Hide modal
7279
this.$el.modal('hide');
7380
DialogView.current = null;
7481
},

0 commit comments

Comments
 (0)