Skip to content

Commit

Permalink
[AutoComplete]Fix Clear Value Issue
Browse files Browse the repository at this point in the history
Removed setting the searchText state from the menu close function and moved the newRequest event after the menu close so that it can be used to overwrite the selected value.

Closes mui#4213
  • Loading branch information
ochowie committed May 11, 2016
1 parent 1f5762b commit a400c7c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/AutoComplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,13 @@ class AutoComplete extends Component {
const chosenRequest = dataSource[index];
const searchText = typeof chosenRequest === 'string' ? chosenRequest : chosenRequest.text;

this.props.onNewRequest(chosenRequest, index);

this.timerTouchTapCloseId = setTimeout(() => {
this.setState({
searchText: searchText,
});
this.close();
this.timerTouchTapCloseId = null;
}, this.props.menuCloseDelay);

this.setState({searchText: searchText});
this.props.onNewRequest(chosenRequest, index);
};

handleEscKeyDown = () => {
Expand Down

0 comments on commit a400c7c

Please sign in to comment.