Skip to content

Commit c36e3e7

Browse files
committed
blur SearchBar on Enter press to hide screen keyboard on mobile devices
1 parent 30f6129 commit c36e3e7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

components/Dropdown/enhanceDropdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ const enhanceDropdown = (CompositeComponent) => class extends Component {
108108
}
109109
}
110110

111-
export default enhanceDropdown
111+
export default enhanceDropdown

components/SearchBar/SearchBar.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class SearchBar extends Component {
7878
this.setState({ searchState: 'focused' })
7979
}
8080

81+
blur() {
82+
this.refs.searchValue.blur()
83+
}
84+
8185
handleSuggestionsUpdate(requestNo, data) {
8286
if (requestNo === this.state.maxRequestNo) {
8387
console.log('SUGGESTIONS', data)
@@ -128,6 +132,7 @@ class SearchBar extends Component {
128132
if (eventKey === 13) {
129133
this.setState({ searchState: 'filled', finalTerm: this.state.searchValue }, function() {
130134
this.search()
135+
this.blur()
131136
})
132137
} else if (eventKey === 39) { // right arrow key is pressed
133138
const suggestion = this.state.suggestions[0]

0 commit comments

Comments
 (0)