#140: do not close popup on overlay click, if a dropdown menu is active

This commit is contained in:
SleepWalker 2016-06-18 15:46:00 +03:00
parent d5ca191ace
commit 2ee5105752

View File

@ -38,7 +38,9 @@ export default class Dropdown extends FormInputComponent {
}; };
componentDidMount() { componentDidMount() {
document.addEventListener('click', this.onBodyClick); // listen to capturing phase to ensure, that our event handler will be
// called before all other
document.addEventListener('click', this.onBodyClick, true);
} }
componentWillUnmount() { componentWillUnmount() {
@ -129,6 +131,7 @@ export default class Dropdown extends FormInputComponent {
if (!el.contains(event.target) && el !== event.taget) { if (!el.contains(event.target) && el !== event.taget) {
event.preventDefault(); event.preventDefault();
event.stopPropagation();
this.toggle(); this.toggle();
} }