I added google reCaptcha in angular material dialog form. But when reCaptcha opens verification popup, it display above the form like in pic.
I also found that whenever mat dialog opens it adds the negative margins to the html tag. And if I remove the margin the captcha verification popup goes into right place but then mat dialog not display properly. I am confused how to make both popup in right place.
Help for reCAPTCHA users There are a few steps you can take to improve your experience: Make sure your browser is fully updated (see minimum browser requirements) Check that JavaScript is enabled in your browser. Try disabling plugins that might conflict with reCAPTCHA.
If reCAPTCHA is not working in your browser, then this issue may arise due to several reasons that include: You are using an older version of your web browser. VPN or proxy service is interrupting with reCAPTCHA. The browser is infected with malware like a browser hijacker, trojan, adware tool, etc.
What is the difference between reCAPTCHA v2 and v3? ReCAPTCHA v2 requires the user to click the “I'm not a robot” checkbox and can serve the user an image recognition challenge. ReCAPTCHA v3 runs in the background and generates a score based on a user's behavior. The higher the score, the more likely the user is human.
It looks like you may have the W3 Total Cache plugin activated on your site. In many cases, caching and minification can result in the reCAPTCHA script being loaded incorrectly.
I solved problem(kind of hack) at that time only but waiting for proper solution.
Peoples asking why I am adding captcha in popup, so guys its product requirement so can't change.
So what I did, I check for the captcha challenge popup when it appears I change the margins set by the material dialog in html tag like below.
checkForChallengePopup() {
const html: HTMLElement = this.document.getElementsByTagName('html')[0];
this.challengePopup = this.document.querySelector(`[title='recaptcha challenge']`);
if (this.challengePopup) {
this.challengePopup.parentElement.style.top = html.style.top.replace('-', '');
} else {
setTimeout(() => {
this.checkForChallengePopup();
}, 3000);
}
}
And yeah it keep on checking for the challenge pop-up till main dialog is not closed so kind a dirty but did the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With