Skip to content

Commit

Permalink
Merge pull request #10068 from hicommonwealth/release/v1.7.4-x
Browse files Browse the repository at this point in the history
pressing enter no longer freezes page
  • Loading branch information
ilijabojanovic authored Dec 2, 2024
2 parents 77b9df4 + d348f5f commit 6522813
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ export const CWSearchBar: FC<SearchBarProps> = ({

const resetSearchBar = () => setSearchTerm('');

const handleOnInput = (e: ChangeEvent<HTMLInputElement>) =>
const handleOnInput = (e: ChangeEvent<HTMLInputElement>) => {
e.stopPropagation();
setSearchTerm(e.target.value);
};

const handleOnKeyUp = (e) => {
e.stopPropagation();
if (e.key === 'Enter') {
e.preventDefault();
handleGoToSearchPage();

if (size === 'small') {
Expand All @@ -112,6 +116,7 @@ export const CWSearchBar: FC<SearchBarProps> = ({
};

const handleOnKeyDown = (e: any) => {
e.stopPropagation();
if (e.key === 'Backspace' && searchTerm.length === 0) {
setShowTag(false);
}
Expand Down

0 comments on commit 6522813

Please sign in to comment.