diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-06-05 20:43:59 +0800 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-06-05 08:43:59 -0400 |
commit | fd6f6a55ceb38f4ecf105a50464fb1a57226c947 (patch) | |
tree | f5e8c6db335290879edc2dadc34bf1bc303eeecd /webapp/components/suggestion/suggestion_box.jsx | |
parent | 14f47f569fdc00124913a7ea513ebea684393396 (diff) | |
download | chat-fd6f6a55ceb38f4ecf105a50464fb1a57226c947.tar.gz chat-fd6f6a55ceb38f4ecf105a50464fb1a57226c947.tar.bz2 chat-fd6f6a55ceb38f4ecf105a50464fb1a57226c947.zip |
[PLT-6616] Fixed autocomplete to close properly (#6528)
* fix autocomplete to close properly
* disable key press of suggestion box when input value is empty
Diffstat (limited to 'webapp/components/suggestion/suggestion_box.jsx')
-rw-r--r-- | webapp/components/suggestion/suggestion_box.jsx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index e1de927b9..a8ee25db9 100644 --- a/webapp/components/suggestion/suggestion_box.jsx +++ b/webapp/components/suggestion/suggestion_box.jsx @@ -237,7 +237,7 @@ export default class SuggestionBox extends React.Component { } handleKeyDown(e) { - if (SuggestionStore.hasSuggestions(this.suggestionId)) { + if (this.props.value && SuggestionStore.hasSuggestions(this.suggestionId)) { if (e.which === KeyCodes.UP) { GlobalActions.emitSelectPreviousSuggestion(this.suggestionId); e.preventDefault(); @@ -330,12 +330,14 @@ export default class SuggestionBox extends React.Component { return ( <div ref='container'> {textbox} - <SuggestionListComponent - suggestionId={this.suggestionId} - location={listStyle} - renderDividers={renderDividers} - onCompleteWord={this.handleCompleteWord} - /> + {this.props.value && + <SuggestionListComponent + suggestionId={this.suggestionId} + location={listStyle} + renderDividers={renderDividers} + onCompleteWord={this.handleCompleteWord} + /> + } </div> ); } |