diff --git a/crates/mdbook-html/front-end/js/book.js b/crates/mdbook-html/front-end/js/book.js index 62d7c4cc87..15426bace8 100644 --- a/crates/mdbook-html/front-end/js/book.js +++ b/crates/mdbook-html/front-end/js/book.js @@ -706,11 +706,21 @@ aria-label="Show hidden lines">'; // Usually needs the Shift key to be pressed switch (e.key) { - case '?': + case '?': { + const active = document.activeElement; + if (active && + ( + active.tagName === 'INPUT' || + active.tagName === 'TEXTAREA' || + active.isContentEditable + )) { + return; + } e.preventDefault(); showHelp(); break; } + } // Rest of the keys are only active when the Shift key is not pressed if (e.shiftKey) {