<div className={'popup-overlay', styles.overlay} onClickCapture={this.handleOverlayClick}>
<div id="popup" ></div>
</div>
handleOverlayClick(e) {
let parent = e.target;
let shouldClose = true;
while (parent && shouldClose && !parent.classList.contains('popup-overlay')) {
if (parent.classList && parent.classList.contains('popup')) {
shouldClose = false;
}
parent = parent.parentNode;
}
if (shouldClose) {
this.handleOnClose();
}
}