diff --git a/src/components/SearchBox/SearchBox.js b/src/components/SearchBox/SearchBox.js index c88c27f..74f8b7c 100644 --- a/src/components/SearchBox/SearchBox.js +++ b/src/components/SearchBox/SearchBox.js @@ -28,7 +28,7 @@ function SearchBox({ fetchProjects }) const classes = useStyles(); const [{ query }, dispatch] = useDataLayerValues(); const [querySearch, setQuerySearch] = useState(query); - const [placeholder, setPlaceholder] = useState("e.g. reactjs (press space to focus)"); + const [placeholder, setPlaceholder] = useState("e.g. reactjs (press space to focus then type and select)"); const searchOptions = [ "reactjs", "javascript", @@ -55,14 +55,12 @@ function SearchBox({ fetchProjects }) const handleSpaceKeyPress = useCallback(event => { - const { keyCode } = event; if (keyCode === 32) { + event.preventDefault(); document.getElementById('searchboxinput').focus(); - setQuerySearch(""); setPlaceholder("e.g. reactjs"); - } }, []); @@ -93,17 +91,16 @@ function SearchBox({ fetchProjects })
setQuerySearch(value)} - freeSolo={true} + freeSolo={false} classes={{ option: classes.option }} renderInput={(params) => (
setQuerySearch(e.target.value)} placeholder={placeholder} className={classes.input} {...params.inputProps}