I've been experiencing this since at least 1.1.21, possibly earlier. It only happens on my production environment for some reason. I'm not able to reproduce it on my staging or local environments, even though those are valid Turnstile domains.

If I switch the CAPTCHA to a different type (math for example) that does not appear twice.

I am only seeing this behavior on Chrome for iOS. Safari for iOS works fine, as does every browser I have tested on my desktop machine. Here is a screenshot:

screenshot

Issue fork turnstile-3541693

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

srdtwc created an issue. See original summary.

srdtwc’s picture

This merge request should fix this issue. I've adjusted the Javascript to load turnstile with a callback, which seems to be the recommendation from Cloudflare. I don't think there's any downsides to this.

After applying this upgrade I had to clear caches. It should be tested thoroughly.

It would be helpful to hear if other people are also experiencing this issue.

srdtwc’s picture

StatusFileSize
new39.5 KB

Screenshot of the form after these changes were applied:

screenshot fixed

greatmatter’s picture

Status: Needs work » Needs review

You've made quite a few changes throughout the code; I'd like to make sure this issue is reproduceable pre-patch before evaluating the patch.

If you're able to check, do you see anything unusual in your mobile Chrome's error console?

srdtwc’s picture

Hmm, I will take a closer look. I only made 2 small changes. I think the branch it merged was not what I intended.

srdtwc’s picture

Ok it should be fixed now, sorry about that!

phernand42’s picture

We had a similar issue with dupe turnstile challenges inside our modal form. There seemed to be a conflict between the modal ajax which was triggered when a user opened the modal and CF rendering. Both were trying to render the challenge which seemed to be creating the dupes inside of our modal. We add the following timeout (via a local patch) to turnstile.ajax.js which removed the dupes for us.

setTimeout(() => {
  if ($(this).is(':empty')) {
    turnstile.render(this);
  }
}, 100);
greatmatter’s picture

If you wouldn't mind, please check the dev version and let me know if the changes fix your issues.

srdtwc’s picture

Thanks for making this change. I tested this out on my local ddev environment and everything appears to work as expected.

greatmatter’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.