Merge pull request #15692 from linusg/autodoc-input-event

autodoc: Start search on any search input event, not just keydown
This commit is contained in:
Loris Cro 2023-05-13 21:19:51 +02:00 committed by GitHub
commit bc17b38788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ||