about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-01-23 11:34:36 +0100
committerGitHub <noreply@github.com>2017-01-23 11:34:36 +0100
commit6062680dd44472d4ba562762dbb6e7e31b59a8b9 (patch)
treef781997d81aeb99cdeebc597dc245acc886e79ba
parent1953e3b6ed255870d46915db3d910345c230f076 (diff)
parent33fd8a7d95034069a4c31bec31be2feb609709e4 (diff)
Merge pull request #513 from mistydemeo/fix_textarea_selection_clicking
Textarea: fix clicking on name suggestions
-rw-r--r--app/assets/javascripts/components/components/autosuggest_textarea.jsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/components/autosuggest_textarea.jsx b/app/assets/javascripts/components/components/autosuggest_textarea.jsx
index 57352be90..81ec7a236 100644
--- a/app/assets/javascripts/components/components/autosuggest_textarea.jsx
+++ b/app/assets/javascripts/components/components/autosuggest_textarea.jsx
@@ -118,12 +118,19 @@ const AutosuggestTextarea = React.createClass({
   },
 
   onBlur () {
-    this.setState({ suggestionsHidden: true });
+    // If we hide the suggestions immediately, then this will prevent the
+    // onClick for the suggestions themselves from firing.
+    // Setting a short window for that to take place before hiding the
+    // suggestions ensures that can't happen.
+    setTimeout(() => {
+      this.setState({ suggestionsHidden: true });
+    }, 100);
   },
 
   onSuggestionClick (suggestion, e) {
     e.preventDefault();
     this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
+    this.textarea.focus();
   },
 
   componentWillReceiveProps (nextProps) {