Skip to content

Commit cffaade

Browse files
Unbind the keydown event listner properly
Otherwise, there are several listners that react to the keydown event.
1 parent 1a9c89e commit cffaade

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

asset/js/widget/ActionList.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,25 @@ define(["../notjQuery"], function (notjQuery) {
1616
bind() {
1717
notjQuery(this.list).on('click', `${LIST_IDENTIFIER} ${LIST_ITEM_IDENTIFIER}, ${LIST_IDENTIFIER} ${LIST_ITEM_IDENTIFIER} a[href]`, this.onClick, this);
1818

19+
this.bindedKeyDown = this.onKeyDown.bind(this)
20+
document.body.addEventListener('keydown', this.bindedKeyDown);
21+
1922
return this;
2023
}
2124

25+
unbind() {
26+
document.body.removeEventListener('keydown', this.bindedKeyDown);
27+
this.bindedKeyDown = null;
28+
}
29+
2230
refresh(list, detailUrl = null) {
2331
if (list === this.list) {
2432
// If the DOM node is still the same, nothing has changed
2533
return;
2634
}
2735

36+
this.unbind();
37+
2838
this.list = list;
2939
this.bind();
3040

0 commit comments

Comments
 (0)