Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott committed Sep 11, 2019
1 parent 70c6bab commit 9d2ea81
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/components/TopBar/components/SearchField/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,24 @@ export function SearchField({
const handleClear = useCallback(() => {
onCancel && onCancel();

if (input.current) {
input.current.value = '';
onChange('');
input.current.focus();
if (!input.current) {
return;
}

input.current.value = '';
onChange('');
input.current.focus();
}, [onCancel, onChange]);

useEffect(() => {
if (input.current) {
if (focused) {
input.current.focus();
} else {
input.current.blur();
}
if (!input.current) {
return;
}

if (focused) {
input.current.focus();
} else {
input.current.blur();
}
}, [focused]);

Expand Down

0 comments on commit 9d2ea81

Please sign in to comment.