Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2023-05-11 18:28:04 +0300
committerSarah German <sgerman@gitlab.com>2023-05-11 18:28:04 +0300
commitdf398823d0685ff638b8713a5e1684b176ecf213 (patch)
tree0ab35a4578dd1aaeb44c4f2adc763b96b7225526
parent9f2ebb3b436e2b44473ba890715a8dffce57f8b8 (diff)
Add keyboard shortcuts for Firefox
-rw-r--r--content/frontend/search/components/google_search_form.vue2
-rw-r--r--content/frontend/search/search_helpers.js7
2 files changed, 5 insertions, 4 deletions
diff --git a/content/frontend/search/components/google_search_form.vue b/content/frontend/search/components/google_search_form.vue
index 1f941685..02baa922 100644
--- a/content/frontend/search/components/google_search_form.vue
+++ b/content/frontend/search/components/google_search_form.vue
@@ -134,7 +134,7 @@ export default {
v-show="showTooltip && !isLoading"
v-gl-tooltip.bottom.hover.html
class="gl-absolute gl-z-index-1 gl-bg-gray-100 gl-text-gray-700"
- title="Use the shortcut key <kbd>/</kbd> to start a search"
+ title="Use the shortcut keys<br><kbd>/</kbd> or <kbd>s</kbd> to start a search"
>/</kbd
>
</form>
diff --git a/content/frontend/search/search_helpers.js b/content/frontend/search/search_helpers.js
index 6ac110df..45ee7b5a 100644
--- a/content/frontend/search/search_helpers.js
+++ b/content/frontend/search/search_helpers.js
@@ -32,9 +32,10 @@ export const updateURLParams = (query) => {
* Keyboard shortcuts.
*/
export const activateKeyboardShortcut = () => {
- document.addEventListener('keyup', (e) => {
- // Focus on search form with the forward slash key.
- if (e.key !== '/' || e.ctrlKey || e.metaKey) return;
+ document.addEventListener('keydown', (e) => {
+ // Focus on the search form with the forward slash and S keys.
+ const shortcutKeys = ['/', 's'];
+ if (!shortcutKeys.includes(e.key) || e.ctrlKey || e.metaKey) return;
if (/^(?:input|textarea|select|button)$/i.test(e.target.tagName)) return;
e.preventDefault();
document.querySelector('input[type="search"]').focus();