Fix popup closing by click

This commit is contained in:
Eduard Kuzmenko 2021-02-27 18:13:58 +04:00
parent 9cb36b9568
commit 190f3cf1aa

View File

@ -55,10 +55,11 @@ export default class PopupElement {
const onOverlayClick = (e: MouseEvent) => { const onOverlayClick = (e: MouseEvent) => {
if(!findUpClassName(e.target, 'popup-container')) { if(!findUpClassName(e.target, 'popup-container')) {
this.btnClose.click(); this.btnClose.click();
this.element.removeEventListener('click', onOverlayClick);
} }
}; };
this.element.addEventListener('click', onOverlayClick, {once: true}); this.element.addEventListener('click', onOverlayClick);
} }
} }