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>
This commit is contained in:
shine 2020-08-26 05:15:32 +05:30 committed by GitHub
parent cc8c605828
commit c86d2b5088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<Shortcut key="g n" on:pressed="goto('/notifications')"/>
<Shortcut key="g c" on:pressed="goto('/community')"/>
<Shortcut key="g d" on:pressed="goto('/direct')"/>
<Shortcut key="s" on:pressed="goto('/search')"/>
<Shortcut key="s|/" on:pressed="goto('/search')"/>
<Shortcut key="h|?" on:pressed="showShortcutHelpDialog()"/>
<Shortcut key="c|7" on:pressed="showComposeDialog()"/>
{#if !$leftRightChangesFocus}

View File

@ -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