Skip to content

Node.js based forum software built for the modern web

fix: stop topic navigation hotkeys from firing if in a mousetrap-enabled form element

Julian Lam17d0b40efacf
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index 961fcd74c3..8f0bf52f25 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -88,7 +88,11 @@ define('forum/topic', [
});
}
- mousetrap.bind('j', () => {
+ mousetrap.bind('j', (e) => {
+ if (e.target.classList.contains('mousetrap')) {
+ return;
+ }
+
const index = navigator.getIndex();
const count = navigator.getCount();
if (index === count) {
@@ -98,7 +102,11 @@ define('forum/topic', [
navigator.scrollToIndex(index, true, 0);
});
- mousetrap.bind('k', () => {
+ mousetrap.bind('k', (e) => {
+ if (e.target.classList.contains('mousetrap')) {
+ return;
+ }
+
const index = navigator.getIndex();
if (index === 1) {
return;