Search Box: Handle focus properly

This commit is contained in:
Scott Nonnenberg 2022-12-09 10:03:32 -08:00 committed by GitHub
parent 2db14e8d6f
commit c0ebafe2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -317,7 +317,7 @@ export function CompositionArea({
if (inputApiRef.current) {
inputApiRef.current.focus();
}
});
}, []);
// Focus input whenever explicitly requested
useEffect(() => {
if (focusCounter !== previousFocusCounter && inputApiRef.current) {

View file

@ -339,7 +339,10 @@ export function reducer(
}
if (action.type === 'SEARCH_CLEAR') {
return getEmptyState();
return {
...getEmptyState(),
startSearchCounter: state.startSearchCounter,
};
}
if (action.type === 'SEARCH_UPDATE') {