Skip to content

Commit

Permalink
Prevent submit on enter/return keyDown
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcauliffe committed Nov 15, 2023
1 parent 2881d2b commit bb7907d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ function CategoriesBrowserPresentation({
filteredCategories,
setQuery,
}) {
const handleKeyDown = (event) => {
if (event.keyCode === 13) {
event.preventDefault()
}
}

return (
<main id="CategoriesBrowserPresentation">
<div className="h-full w-full bg-white p-4 min-h-screen">
Expand All @@ -26,6 +32,7 @@ function CategoriesBrowserPresentation({
className="h-full w-full border-transparent px-4 py-2 pl-8 pr-3 bg-gray-100 rounded text-base text-gray-900 placeholder-gray-500 focus:outline-none focus:ring-0 focus:border-transparent focus:placeholder-gray-400 sm:block"
placeholder="Search all Categories"
onChange={(event) => setQuery(event.target.value)}
onKeyDown={handleKeyDown}
/>
</div>
</form>
Expand Down

0 comments on commit bb7907d

Please sign in to comment.