Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensures an anonymous shortcut fn can be used globally (#9605)

Joffrey JAFFEUX2d287ef16a90
diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
index b9b5ed22b43..2fe61c5be9a 100644
--- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
+++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
@@ -494,7 +494,7 @@ export default {
_globalBindToFunction(func, binding) {
let funcToBind = typeof func === "function" ? func : this[func];
if (typeof funcToBind === "function") {
- this.keyTrapper.bindGlobal(binding, this[func].bind(this));
+ this.keyTrapper.bindGlobal(binding, funcToBind.bind(this));
}
},