commit bebb6a45a5e439ded35d2451e3575b2839884810 (tree)
parent 46527292178d64daa9f81be3eef378d78d254b5d
Author: Linus Groh <mail@linusgroh.de>
Date: Sat, 13 May 2023 17:52:13 +0100
autodoc: Start search on any search input event, not just keydown
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/docs/main.js b/lib/docs/main.js
@@ -133,6 +133,7 @@ const NAV_MODES = {
domSearch.disabled = false;
domSearch.addEventListener("keydown", onSearchKeyDown, false);
+ domSearch.addEventListener("input", onSearchInput, false);
domSearch.addEventListener("focus", ev => {
domSearchPlaceholder.classList.add("hidden");
canToggleHelpModal = false;
@@ -4009,15 +4010,17 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) {
ev.stopPropagation();
return;
default:
- if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
-
- curSearchIndex = -1;
+ // Search is triggered via an `input` event handler, not on arbitrary `keydown` events.
ev.stopPropagation();
- startAsyncSearch();
return;
}
}
+ function onSearchInput(ev) {
+ curSearchIndex = -1;
+ startAsyncSearch();
+ }
+
function moveSearchCursor(dir) {
if (
curSearchIndex < 0 ||