Skip to content

Commit

Permalink
Add submit on enter key down for input field
Browse files Browse the repository at this point in the history
  • Loading branch information
Bklieger committed Mar 31, 2024
1 parent eac3a45 commit ccd0731
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/components/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ const handlePageClick = (pageNumber: number) => {
placeholder="Describe your query. Matches based on meaning, not keywords."
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(event) => {
if (event.key === 'Enter') {
handleSearch();
}
}}
/>
<button
className="ml-2 px-4 py-2 bg-[#407BBF] text-white font-semibold rounded-md shadow hover:bg-[#396EAB] focus:outline-none"
Expand Down

0 comments on commit ccd0731

Please sign in to comment.