Skip to content

Commit

Permalink
Temporary blur fix for #455
Browse files Browse the repository at this point in the history
Added a click listener for document to blur the combo box input when you
click outside it
  • Loading branch information
devgeeks committed Jan 12, 2017
1 parent f6b25e1 commit 8f99b28
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/containers/ConnectTab/ConnectTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ class ConnectTab extends Component {
const addr = loaded.address;
this.setState({ url: addr });
});
// Bind click outside the ComboBox input to blur the input
// @TODO Remove after fixing https://github.com/moroshko/react-autosuggest/issues/286
document.addEventListener('click', this.blurComboBox, false);
}

blurComboBox(e) { // eslint-disable-line class-methods-use-this
if (e.target.tagName === 'INPUT') return;
const input = document.querySelector('.topcoat-combobox__select');
input && input.blur();
}

componentDidUnmount() {
document.removeEventListener('click', this.blurComboBox, false);
}

handleButtonClick(button) {
Expand Down

0 comments on commit 8f99b28

Please sign in to comment.