@@ -11,6 +11,10 @@ class AutocompleteInputContainer extends React.Component {
1111 constructor ( props ) {
1212 super ( props )
1313 this . debounceTimer = null
14+ this . state = {
15+ // field input value
16+ inputValue : ''
17+ }
1418
1519 this . clearUserSuggestions = this . clearUserSuggestions . bind ( this )
1620 }
@@ -27,7 +31,11 @@ class AutocompleteInputContainer extends React.Component {
2731 }
2832 }
2933
30- onInputChange ( inputValue ) {
34+ onInputChange ( inputValue , reason ) {
35+ // for keeping inputValue
36+ if ( reason . action === 'input-blur' || reason . action === 'menu-close' ) {
37+ return
38+ }
3139 const indexOfSpace = inputValue . indexOf ( ' ' )
3240 const indexOfSemiColon = inputValue . indexOf ( ';' )
3341
@@ -36,6 +44,7 @@ class AutocompleteInputContainer extends React.Component {
3644 return ''
3745 }
3846
47+ this . setState ( { inputValue} )
3948 if ( indexOfSpace >= 1 || indexOfSemiColon >= 1 ) {
4049 inputValue = inputValue . substring ( 0 , inputValue . length - 1 )
4150 this . onUpdate ( [ ...this . props . selectedMembers , { label : inputValue , value : inputValue } ] )
@@ -69,9 +78,11 @@ class AutocompleteInputContainer extends React.Component {
6978 render ( ) {
7079
7180 const { placeholder, currentUser, selectedMembers, disabled } = this . props
81+ const { inputValue} = this . state
7282
7383 return (
7484 < AutocompleteInput
85+ inputValue = { inputValue }
7586 placeholder = { placeholder ? placeholder :'' }
7687 onInputChange = { this . onInputChange . bind ( this ) }
7788 onUpdate = { this . onUpdate . bind ( this ) }
0 commit comments