Skip to content

Commit

Permalink
fix error on hit ENTER when search value leaves no options
Browse files Browse the repository at this point in the history
  • Loading branch information
wcastand committed Oct 19, 2017
1 parent dfc590d commit 0d0283e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ export function withKeyboardEvent(BaseComponent) {
case 13: // ENTER
case 9: // TAB
if (currentValue !== null) {
onSelectValue(this.props.options[currentValue])
toggleSelect(false)
clearSearchValue(false)
this.setState({currentValue: null})
e.stopPropagation()
e.preventDefault()
if (typeof this.props.options[currentValue] !== 'undefined') {
onSelectValue(this.props.options[currentValue])
toggleSelect(false)
clearSearchValue(false)
this.setState({currentValue: null})
e.stopPropagation()
e.preventDefault()
}
}
break
case 40: // DOWN
Expand Down

0 comments on commit 0d0283e

Please sign in to comment.