aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-12-11 19:26:56 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-12-11 19:26:56 +0100
commit6ef491badd4ac0190ab17cc41ebd27abbf87c896 (patch)
tree86e5250bfa255be30ac64ecb0e707f27d50e72a7
parentddccdcf22bb5008022e93c4789311fb2da95d7cf (diff)
Select search input on focus
-rw-r--r--src/client/react/components/container/Search.js1
-rw-r--r--src/client/react/components/presentational/Search.jsx3
2 files changed, 2 insertions, 2 deletions
diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js
index f17a517..4517191 100644
--- a/src/client/react/components/container/Search.js
+++ b/src/client/react/components/container/Search.js
@@ -15,6 +15,7 @@ const mapDispatchToProps = dispatch => ({
},
onFocus: () => {
dispatch(focusChange(true));
+ document.querySelector('#search__input').select();
},
onBlur: () => {
dispatch(focusChange(false));
diff --git a/src/client/react/components/presentational/Search.jsx b/src/client/react/components/presentational/Search.jsx
index 78beb56..fc8ca98 100644
--- a/src/client/react/components/presentational/Search.jsx
+++ b/src/client/react/components/presentational/Search.jsx
@@ -35,7 +35,6 @@ IconFromUserType.defaultProps = {
userType: null,
};
-
const Result = ({ user }) => (
<div className="search__result">
<div className="search__icon-wrapper"><IconFromUserType userType={user.type} /></div>
@@ -61,6 +60,7 @@ const Search = ({
{/* Show the icon from the exact match if there is an exact match, otherwise show the search icon. */}
<div className="search__icon-wrapper"><IconFromUserType userType={exactMatch ? exactMatch.type : null} /></div>
<input
+ id="search__input"
onChange={onInputChange}
value={value}
placeholder="Zoeken"
@@ -88,5 +88,4 @@ Search.defaultProps = {
exactMatch: null,
};
-
export default Search;