authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-05-13 21:19:51+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-05-13 21:19:51+02:00
logbc17b38788e173afefc6a4770e5b0610dbe44670
treec9293e00083ac91032dd28175dbbc6c3fe7b686b
parent4697b30ba01668b4a9418aba1cdddf08c5036a11
parentbebb6a45a5e439ded35d2451e3575b2839884810
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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

autodoc: Start search on any search input event, not just keydown

1 files changed, 7 insertions(+), 4 deletions(-)

lib/docs/main.js+7-4
......@@ -133,6 +133,7 @@ const NAV_MODES = {
133133
134134 domSearch.disabled = false;
135135 domSearch.addEventListener("keydown", onSearchKeyDown, false);
136 domSearch.addEventListener("input", onSearchInput, false);
136137 domSearch.addEventListener("focus", ev => {
137138 domSearchPlaceholder.classList.add("hidden");
138139 canToggleHelpModal = false;
......@@ -4009,15 +4010,17 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) {
40094010 ev.stopPropagation();
40104011 return;
40114012 default:
4012 if (ev.shiftKey || ev.ctrlKey || ev.altKey) return;
4013
4014 curSearchIndex = -1;
4013 // Search is triggered via an `input` event handler, not on arbitrary `keydown` events.
40154014 ev.stopPropagation();
4016 startAsyncSearch();
40174015 return;
40184016 }
40194017 }
40204018
4019 function onSearchInput(ev) {
4020 curSearchIndex = -1;
4021 startAsyncSearch();
4022 }
4023
40214024 function moveSearchCursor(dir) {
40224025 if (
40234026 curSearchIndex < 0 ||