Merge pull request #513 from mistydemeo/fix_textarea_selection_clicking

Textarea: fix clicking on name suggestions
This commit is contained in:
Eugen 2017-01-23 11:34:36 +01:00 committed by GitHub
commit 6062680dd4
1 changed files with 8 additions and 1 deletions

View File

@ -118,12 +118,19 @@ const AutosuggestTextarea = React.createClass({
}, },
onBlur () { onBlur () {
// 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 }); this.setState({ suggestionsHidden: true });
}, 100);
}, },
onSuggestionClick (suggestion, e) { onSuggestionClick (suggestion, e) {
e.preventDefault(); e.preventDefault();
this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion); this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
this.textarea.focus();
}, },
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {