Skip to content

Commit

Permalink
fix(SearchInput): retain focus on input field after clearing with "…
Browse files Browse the repository at this point in the history
…x" icon (#678)
  • Loading branch information
cheton authored Feb 2, 2023
1 parent c3ed710 commit 754c8f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/search-input/SearchInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const SearchInput = React.forwardRef((
return;
}

inputRef.current.value = '';
if (inputRef.current) {
inputRef.current.value = '';
inputRef.current.focus(); // Retain focus on the input after clearing
}

setIsClearable(false);

if (typeof onClearInputProp === 'function') {
Expand Down

0 comments on commit 754c8f3

Please sign in to comment.