Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

carol/ Search box hotfix #5749

Merged
merged 11 commits into from
Jun 20, 2022
3 changes: 3 additions & 0 deletions packages/p2p/src/components/search-box/search-box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const SearchBox = ({ className, onClear, onSearch, placeholder }) => {
}
};

const onSearchKeyDown = (search, submitForm) => (search ? submitForm() : onClear());

const onSearchKeyUp = submitForm => {
clearTimeout(typing_timer);

Expand Down Expand Up @@ -44,6 +46,7 @@ const SearchBox = ({ className, onClear, onSearch, placeholder }) => {
type='text'
name='search'
placeholder={placeholder}
onKeyDown={() => onSearchKeyDown(search, submitForm)}
onKeyUp={() => onSearchKeyUp(submitForm)}
onFocus={submitForm}
leading_icon={<Icon className='search-box__field-icon' icon='IcSearch' />}
Expand Down