From 60d7aae725534541f74582337f3abd89ba89b20f Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Mon, 20 Sep 2021 00:23:27 +0100 Subject: [PATCH] Fix search bar event listener --- src/components/SearchBar/index.tsx | 4 ++-- src/components/SearchBar/styles.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/SearchBar/index.tsx b/src/components/SearchBar/index.tsx index 60b7614..e571e01 100644 --- a/src/components/SearchBar/index.tsx +++ b/src/components/SearchBar/index.tsx @@ -8,7 +8,7 @@ const SearchBar: React.FC = () => { const history = useHistory(); const search = (event: React.KeyboardEvent) => { - if (event.key === 'Enter' && query !== '') { + if ((event.key === 'Enter' || event.keyCode === 13) && query !== '') { history.push(`/search/${query}`); setQuery(''); } @@ -19,7 +19,7 @@ const SearchBar: React.FC = () => { ) => setQuery(event.target.value)} /> Search icon diff --git a/src/components/SearchBar/styles.ts b/src/components/SearchBar/styles.ts index 596e60d..1d43c66 100644 --- a/src/components/SearchBar/styles.ts +++ b/src/components/SearchBar/styles.ts @@ -16,6 +16,7 @@ export const Input = styled.input` border: none; border-radius: 5px; overflow: hidden; + user-select: text !important; &::placeholder { color: rgba(0, 0, 0, 0.5);