diff --git a/src/bundle/ui-dev/src/modules/common/popup/popup.component.js b/src/bundle/ui-dev/src/modules/common/popup/popup.component.js index 4c9064be67..035f76b562 100644 --- a/src/bundle/ui-dev/src/modules/common/popup/popup.component.js +++ b/src/bundle/ui-dev/src/modules/common/popup/popup.component.js @@ -62,6 +62,7 @@ const Popup = ({ }); const closeBtnLabel = Translator.trans(/*@Desc("Close")*/ 'popup.close.label', {}, 'ibexa_universal_discovery_widget'); const hidePopup = () => { + modalRef.current.removeEventListener('hidden.bs.modal', onClose); bootstrap.Modal.getOrCreateInstance(modalRef.current).hide(); rootDOMElement.classList.remove(CLASS_MODAL_OPEN, CLASS_NON_SCROLLABLE); }; @@ -79,10 +80,13 @@ const Popup = ({ bootstrapModal.show(); }; - const handleOnClick = (event, onClick) => { + const handleOnClick = (event, onClick, preventClose) => { modalRef.current.removeEventListener('hidden.bs.modal', onClose); - hidePopup(); - onClick(event); + if (!preventClose) { + hidePopup(); + } + + onClick(event, hidePopup); }; const renderCloseBtn = () => { if (noCloseBtn) { @@ -119,12 +123,12 @@ const Popup = ({ )}
{children}
- {actionBtnsConfig.map(({ className, onClick, disabled = false, label, ...extraProps }) => ( + {actionBtnsConfig.map(({ className, onClick, disabled = false, preventClose = false, label, ...extraProps }) => (