Skip to content
Snippets Groups Projects
Commit 4a4cb684 authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #3960 from OZhurbenko/dropdown-listeners-fix

HTML5 - dropdown click listeners' fix
parents 250c6cdb c4250c3f
No related branches found
No related tags found
No related merge requests found
......@@ -82,11 +82,17 @@ class Dropdown extends Component {
}
handleShow() {
const { addEventListener } = window;
addEventListener('click', this.handleWindowClick, false);
this.setState({ isOpen: true }, this.handleStateCallback);
}
handleHide() {
const { removeEventListener } = window;
removeEventListener('click', this.handleWindowClick, false);
const { autoFocus } = this.props;
this.setState({ isOpen: false }, this.handleStateCallback);
......@@ -97,16 +103,6 @@ class Dropdown extends Component {
}
}
componentDidMount () {
const { addEventListener } = window;
addEventListener('click', this.handleWindowClick, false);
}
componentWillUnmount () {
const { removeEventListener } = window;
removeEventListener('click', this.handleWindowClick, false);
}
handleWindowClick(event) {
const dropdownElement = findDOMNode(this);
const shouldUpdateState = event.target !== dropdownElement &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment