Skip to content

Commit

Permalink
added slash as additional trigger for search
Browse files Browse the repository at this point in the history
  • Loading branch information
rik86189 committed Jul 27, 2024
1 parent ec996d3 commit f0628f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/theme/searcher/searcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ window.search = window.search || {};
URL_MARK_PARAM = 'highlight',
teaser_count = 0,

SEARCH_HOTKEY_KEYCODE = 83,
SEARCH_HOTKEY_KEYCODE_S = 83,
SEARCH_HOTKEY_KEYCODE_SLASH = 191,
ESCAPE_KEYCODE = 27,
DOWN_KEYCODE = 40,
UP_KEYCODE = 38,
Expand Down Expand Up @@ -328,7 +329,7 @@ window.search = window.search || {};
}
showSearch(false);
marker.unmark();
} else if (!hasFocus() && e.keyCode === SEARCH_HOTKEY_KEYCODE) {
} else if ((!hasFocus() && e.keyCode === SEARCH_HOTKEY_KEYCODE_S) || (!hasFocus() && e.keyCode === SEARCH_HOTKEY_KEYCODE_SLASH)) {
e.preventDefault();
showSearch(true);
window.scrollTo(0, 0);
Expand Down

0 comments on commit f0628f9

Please sign in to comment.