fix: Escape key in keyboard shortcut guide should clear search input if search term

This commit is contained in:
Tom Moor
2021-04-22 19:37:40 -07:00
parent 40b4270e35
commit f2052c2a05
2 changed files with 22 additions and 4 deletions

View File

@ -22,7 +22,9 @@ type Props = {
collectionId?: string,
redirectDisabled?: boolean,
maxWidth?: string,
value: string,
onChange: (event: SyntheticInputEvent<>) => mixed,
onKeyDown: (event: SyntheticKeyboardEvent<>) => mixed,
t: TFunction,
};
@ -59,7 +61,7 @@ class InputSearch extends React.Component<Props> {
};
render() {
const { t, redirectDisabled, onChange } = this.props;
const { t, redirectDisabled, value, onChange, onKeyDown } = this.props;
const { theme, placeholder = `${t("Search")}` } = this.props;
return (
@ -68,7 +70,9 @@ class InputSearch extends React.Component<Props> {
type="search"
placeholder={placeholder}
onInput={redirectDisabled ? undefined : this.handleSearchInput}
value={value}
onChange={onChange}
onKeyDown={onKeyDown}
icon={
<SearchIcon
color={this.focused ? theme.inputBorderFocused : theme.inputBorder}