There was an error while loading. Please reload this page.
1 parent 56932ab commit bd89403Copy full SHA for bd89403
1 file changed
website/themes/book/assets/search.js
@@ -24,6 +24,14 @@
24
return;
25
}
26
27
+ // Don't hijack typing in other editable fields (e.g. the Gitalk comment box).
28
+ // Otherwise a search hotkey ("s" / "/") typed there steals focus to the search
29
+ // box, making it lose focus after every keystroke.
30
+ const active = document.activeElement;
31
+ if (active && (active.tagName === 'INPUT' || active.tagName === 'TEXTAREA' || active.tagName === 'SELECT' || active.isContentEditable)) {
32
+ return;
33
+ }
34
+
35
const characterPressed = String.fromCharCode(event.charCode);
36
if (!isHotkey(characterPressed)) {
37
0 commit comments