Skip to content

Commit

Permalink
Submit new empty search on clear to reset results
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 24, 2024
1 parent 5b62400 commit e84ce97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/components/inputs/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
export let name: string = null;
export let query: string = "";
let input: HTMLInputElement;
let form: HTMLFormElement;
function clear() {
query = "";
input.focus();
form.submit();
}
</script>

<form class="container" on:submit>
<form class="container" on:submit bind:this={form}>
<label for="query" title="Search"><Search24 /></label>
<input
type="search"
Expand Down

0 comments on commit e84ce97

Please sign in to comment.