Skip to content

Commit

Permalink
[ESD-12716] Fix issue with recaptcha on mobile when using a different…
Browse files Browse the repository at this point in the history
… lang (#1988)
  • Loading branch information
jfromaniello authored Apr 26, 2021
1 parent 80064d2 commit 65ada89
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/field/captcha/recaptcha.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,24 @@ export class ReCAPTCHA extends React.Component {
}
*/
const fixInterval = setInterval(() => {
let iframes = Array.from(document.querySelectorAll(`iframe[title="recaptcha challenge"]`));

iframes = iframes.filter(iframe => iframe.parentNode.parentNode.style.display !== 'block');

if (iframes.length === 0) {
const iframes = Array.from(document.querySelectorAll(`iframe[src*="recaptcha"]`));

const containers = iframes
.map(iframe => iframe.parentNode.parentNode)
.filter(container => {
return (
container &&
container.parentNode === document.body &&
container.style.display !== 'block'
);
});

if (containers.length === 0) {
return;
}

iframes.forEach(iframe => {
iframe.parentNode.parentNode.style.display = 'block';
containers.forEach(iframe => {
iframe.style.display = 'block';
});

clearInterval(fixInterval);
Expand Down

0 comments on commit 65ada89

Please sign in to comment.