Skip to content

Commit

Permalink
Pagefind UIs: Don't clear input when hitting Enter
Browse files Browse the repository at this point in the history
  • Loading branch information
bglw committed Mar 1, 2023
1 parent 053726c commit 3e3a563
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pagefind_ui/default/svelte/ui.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@
val = "";
input_el.blur();
}
if (e.key === "Enter") {
e.preventDefault();
}
}}
bind:value={val}
bind:this={input_el}
Expand Down
3 changes: 3 additions & 0 deletions pagefind_ui/modular/components/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class Input {
this.instance?.triggerSearch("");
this.updateState("");
}
if (e.key === "Enter") {
e.preventDefault();
}
});
this.inputEl.addEventListener("focus", () => {
this.instance?.triggerLoad();
Expand Down

0 comments on commit 3e3a563

Please sign in to comment.