From 5c9fe6c0fd48988dc6303d9551f9d99145a8db95 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 20 Oct 2022 21:59:29 -0400 Subject: [PATCH] fix: stop topic navigation hotkeys from firing if in a mousetrap-enabled form element --- public/src/client/topic.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index e3c98e5a11..f9c526fa3a 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -89,7 +89,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) { @@ -99,7 +103,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;