We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a92615d commit a7c219eCopy full SHA for a7c219e
components/SearchBar/SearchBar.jsx
@@ -99,10 +99,12 @@ class SearchBar extends Component {
99
this.search()
100
})
101
} else if (eventKey === 39) { // right arrow key is pressed
102
- const suggestion = this.state.suggestions[0]
103
- this.refs.searchValue.value = suggestion
104
- // trigger the change event handler
105
- this.onChange()
+ const suggestion = this.state.suggestions.length > 0 ? this.state.suggestions[0] : null
+ if (suggestion) {
+ this.refs.searchValue.value = suggestion
+ // trigger the change event handler
106
+ this.onChange()
107
+ }
108
}
109
110
0 commit comments