Add backspace shortcut to go back
This commit is contained in:
@@ -105,6 +105,11 @@ const input_keyup = e => {
|
|||||||
if (selected_result+1 < search_results.length) {
|
if (selected_result+1 < search_results.length) {
|
||||||
selected_result++
|
selected_result++
|
||||||
}
|
}
|
||||||
|
} else if (e.key === "Backspace" && search_term === "") {
|
||||||
|
// You can use backspace to go back to the previous page, handy if you
|
||||||
|
// searched for the wrong thing and want to go back
|
||||||
|
history.back()
|
||||||
|
e.preventDefault()
|
||||||
} else {
|
} else {
|
||||||
search()
|
search()
|
||||||
}
|
}
|
||||||
@@ -163,7 +168,7 @@ const window_keydown = (e) => {
|
|||||||
bind:this={search_bar}
|
bind:this={search_bar}
|
||||||
class="term"
|
class="term"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Type to search in {$nav.base.name}"
|
placeholder="Press / to search in {$nav.base.name}"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
bind:value={search_term}
|
bind:value={search_term}
|
||||||
on:keydown={input_keydown}
|
on:keydown={input_keydown}
|
||||||
|
Reference in New Issue
Block a user