mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[PLT-6616] Fixed autocomplete to close properly (#6528)
* fix autocomplete to close properly * disable key press of suggestion box when input value is empty
This commit is contained in:
committed by
Harrison Healey
parent
14f47f569f
commit
fd6f6a55ce
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user