FIX: Prevent typing "#" when showing "Jump to…"

FIX: Prevent typing “#” when showing “Jump to…”

Closes https://meta.discourse.org/t/the-shortcut-behaves-wrong-in-some-browsers/155531

diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
index 29cfaaf..f887d2e 100644
--- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
+++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
@@ -355,7 +355,8 @@ export default {
     this.container.lookup("controller:topic").togglePinnedState();
   },
 
-  goToPost() {
+  goToPost(event) {
+    preventKeyboardEvent(event);
     this.appEvents.trigger("topic:keyboard-trigger", { type: "jump" });
   },
 

GitHub sha: 13087cab

2 Likes

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/the-shortcut-behaves-wrong-in-some-browsers/155531/6

Btw. I was bending over backwards trying to test it, but no matter what combination of events I tried, Safari didn’t exhibit the same behavior in the test environment… bummer :crying_cat_face:

1 Like