Merge pull request #3960 from OZhurbenko/dropdown-listeners-fix
HTML5 - dropdown click listeners' fix
This commit is contained in:
commit
4a4cb684ac
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user