Add backspace shortcut to go back

This commit is contained in:
2024-11-14 22:13:19 +01:00
parent 5c4255dbbf
commit cac31a097a

View File

@@ -105,6 +105,11 @@ const input_keyup = e => {
if (selected_result+1 < search_results.length) {
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 {
search()
}
@@ -163,7 +168,7 @@ const window_keydown = (e) => {
bind:this={search_bar}
class="term"
type="text"
placeholder="Type to search in {$nav.base.name}"
placeholder="Press / to search in {$nav.base.name}"
style="width: 100%;"
bind:value={search_term}
on:keydown={input_keydown}