From c86d2b5088a35cb70e5b28cf34d3721f94725b74 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 26 Aug 2020 05:15:32 +0530 Subject: [PATCH] feat: add `/` as a navigation shortcut for search (#1838) `/` is a well-known vi/vim key-binding for search. It is supported by Firefox for a 'quick find' feature in addition to the main find feature available with the Ctrl+F key combination. DuckDuckGo also supports the key to focus the search bar as well. Signed-off-by: shine <4771718+shinenelson@users.noreply.github.com> --- src/routes/_components/NavShortcuts.html | 2 +- tests/spec/024-shortcuts-navigation.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/_components/NavShortcuts.html b/src/routes/_components/NavShortcuts.html index 5087d59a..f31d9c37 100644 --- a/src/routes/_components/NavShortcuts.html +++ b/src/routes/_components/NavShortcuts.html @@ -5,7 +5,7 @@ - + {#if !$leftRightChangesFocus} diff --git a/tests/spec/024-shortcuts-navigation.js b/tests/spec/024-shortcuts-navigation.js index 149ad2f6..208b8658 100644 --- a/tests/spec/024-shortcuts-navigation.js +++ b/tests/spec/024-shortcuts-navigation.js @@ -60,6 +60,14 @@ test('Shortcut s goes to the search page', async t => { .expect(getUrl()).contains('/search') }) +test('Shortcut / goes to the search page', async t => { + await loginAsFoobar(t) + await t + .expect(getUrl()).eql('http://localhost:4002/') + .pressKey('/') + .expect(getUrl()).contains('/search') +}) + test('Shortcut backspace goes back from favorites', async t => { await loginAsFoobar(t) await t