Skip to content

Commit

Permalink
fix(searchBox): autofocus input when modal opens (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed May 11, 2020
1 parent 67b4c55 commit 09f1856
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/SearchBox/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const SearchBox = (props) => {
props.onReset();
}

React.useEffect(() => {
if (inputRef.current) {
inputRef.current.focus();
}
}, [inputRef]);

return (
<div className="ais-SearchBox">
<form
Expand Down Expand Up @@ -102,7 +108,6 @@ export const SearchBox = (props) => {
autoCapitalize="off"
spellCheck={false}
maxLength={512}
autoFocus
placeholder={props.translations.placeholder}
value={props.currentRefinement}
onChange={props.onChange}
Expand Down

0 comments on commit 09f1856

Please sign in to comment.