Merge pull request #15512 from cryptocode/autodoc-searchkey

autodoc: Add / as an alternative search key
This commit is contained in:
Loris Cro 2023-06-18 09:06:51 +02:00 committed by GitHub
commit 329a585fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -758,7 +758,7 @@
<div class="wrap">
<section class="docs" style="padding-top: 1.5rem; padding-bottom:0;">
<div style="position: relative">
<span id="searchPlaceholder"><kbd>s</kbd> to search, <kbd>?</kbd> for more options</span>
<span id="searchPlaceholder"><kbd>/</kbd> or <kbd>s</kbd> to search, <kbd>?</kbd> for more options</span>
<input type="search" class="search" id="search" autocomplete="off" spellcheck="false" disabled>
</div>
</section>
@ -876,7 +876,7 @@
<div class="modal">
<h1>Keyboard Shortcuts</h1>
<dl><dt><kbd>?</kbd></dt><dd>Toggle this help modal</dd></dl>
<dl><dt><kbd>s</kbd></dt><dd>Focus the search field</dd></dl>
<dl><dt><kbd>s</kbd> or <kbd>/</kbd></dt><dd>Focus the search field</dd></dl>
<div style="margin-left: 1em">
<dl><dt><kbd></kbd></dt><dd>Move up in search results</dd></dl>
<dl><dt><kbd></kbd></dt><dd>Move down in search results</dd></dl>

View File

@ -4106,6 +4106,7 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) {
case "Esc":
onEscape(ev);
break;
case "/":
case "s":
if (domHelpModal.classList.contains("hidden")) {
if (ev.target == domSearch) break;