From d348f5fb5ccbdce5b3c2aa854af99766acf56ecd Mon Sep 17 00:00:00 2001 From: israellund Date: Sat, 30 Nov 2024 09:23:05 -0500 Subject: [PATCH] pressing enter no longer freezes page --- .../component_kit/new_designs/CWSearchBar/CWSearchBar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWSearchBar/CWSearchBar.tsx b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWSearchBar/CWSearchBar.tsx index 645f6960a6d..3dbbe318581 100644 --- a/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWSearchBar/CWSearchBar.tsx +++ b/packages/commonwealth/client/scripts/views/components/component_kit/new_designs/CWSearchBar/CWSearchBar.tsx @@ -84,11 +84,15 @@ export const CWSearchBar: FC = ({ const resetSearchBar = () => setSearchTerm(''); - const handleOnInput = (e: ChangeEvent) => + const handleOnInput = (e: ChangeEvent) => { + e.stopPropagation(); setSearchTerm(e.target.value); + }; const handleOnKeyUp = (e) => { + e.stopPropagation(); if (e.key === 'Enter') { + e.preventDefault(); handleGoToSearchPage(); if (size === 'small') { @@ -112,6 +116,7 @@ export const CWSearchBar: FC = ({ }; const handleOnKeyDown = (e: any) => { + e.stopPropagation(); if (e.key === 'Backspace' && searchTerm.length === 0) { setShowTag(false); }