Skip to content

Commit

Permalink
Fix reCaptcha position in reveals
Browse files Browse the repository at this point in the history
Currently if a recaptcha (v2) in a Reveal is active it is not visible and therefore can't be submitted. This fixes it.
Only tested with the Formidable Forms Plugin, but should be an issue with all implementations.
  • Loading branch information
SimonMayerhofer committed Feb 8, 2022
1 parent d17575d commit c2e6797
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import './components/iconlist';
// import FA last, to kick off the process of finding <i> tags and
// replacing with <svg> tags, after importing all components.
import './lib/FontAwesome';
import './lib/reCaptcha';

// because jQuery is included with webpack.ProvidePlugin we can
// just use jQuery and $ variables without importing it again.
10 changes: 10 additions & 0 deletions src/assets/js/lib/reCaptcha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function fixReCaptchaPosition() {
jQuery('body > div > div > iframe[src^="https://www.google.com/recaptcha/"]')
.parent()
.parent()
.addClass('recaptcha-wrapper');
}

setInterval(() => {
fixReCaptchaPosition();
}, 250);
6 changes: 6 additions & 0 deletions src/assets/scss/global/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
.full-width {
@include full-width;
}

/* fix recaptcha position in reveals */
.is-reveal-open .recaptcha-wrapper {
position: fixed !important;
z-index: 99999;
}

0 comments on commit c2e6797

Please sign in to comment.