From 641fc48a4dee06e372dc5eed9c4bf1c947aa985f Mon Sep 17 00:00:00 2001 From: Abdi Tolessa <41271840+AbdiTolesa@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:24:57 +0300 Subject: [PATCH 1/3] Fix Captcha not rendering in bs modal --- js/formidable.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/formidable.js b/js/formidable.js index 2d3f49cb6e..e1c4d9e61a 100644 --- a/js/formidable.js +++ b/js/formidable.js @@ -1860,7 +1860,15 @@ function frmCaptcha( captchaSelector ) { const cl = captchas.length; for ( c = 0; c < cl; c++ ) { const closestForm = captchas[c].closest( 'form' ); - const formIsVisible = closestForm && closestForm.offsetParent !== null; + if ( ! closestForm ) { + continue; + } + let formIsVisible; + if ( closestForm.closest( '[id^=frm-modal-]' ) ) { + formIsVisible = true; + } else { + formIsVisible = closestForm.offsetParent !== null; + } if ( ! formIsVisible ) { continue; } From d96f14bbb3e09cd18efbfe5d29c5f396996b5121 Mon Sep 17 00:00:00 2001 From: Abdi Tolessa <41271840+AbdiTolesa@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:30:50 +0300 Subject: [PATCH 2/3] Add comment to changes --- js/formidable.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/formidable.js b/js/formidable.js index e1c4d9e61a..c7c5532ad4 100644 --- a/js/formidable.js +++ b/js/formidable.js @@ -1863,13 +1863,13 @@ function frmCaptcha( captchaSelector ) { if ( ! closestForm ) { continue; } - let formIsVisible; + let shouldRenderCaptcha; if ( closestForm.closest( '[id^=frm-modal-]' ) ) { - formIsVisible = true; + shouldRenderCaptcha = true; } else { - formIsVisible = closestForm.offsetParent !== null; + shouldRenderCaptcha = closestForm.offsetParent !== null; // Form is visible if offsetParent is not null. } - if ( ! formIsVisible ) { + if ( ! shouldRenderCaptcha ) { continue; } frmFrontForm.renderCaptcha( captchas[c], captchaSelector ); From 72448343b21b8c7cfd333a77199c2a0c21c4e61a Mon Sep 17 00:00:00 2001 From: Abdi Tolessa <41271840+AbdiTolesa@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:31:39 +0300 Subject: [PATCH 3/3] Add comment to changes --- js/formidable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/formidable.js b/js/formidable.js index c7c5532ad4..a91863aecb 100644 --- a/js/formidable.js +++ b/js/formidable.js @@ -1864,7 +1864,7 @@ function frmCaptcha( captchaSelector ) { continue; } let shouldRenderCaptcha; - if ( closestForm.closest( '[id^=frm-modal-]' ) ) { + if ( closestForm.closest( '[id^=frm-modal-]' ) ) { // Form is in a modal. shouldRenderCaptcha = true; } else { shouldRenderCaptcha = closestForm.offsetParent !== null; // Form is visible if offsetParent is not null.