marsidev / react-turnstile

Cloudflare Turnstile integration for React.
https://www.npmjs.com/package/@marsidev/react-turnstile
MIT License
412 stars 25 forks source link

conditional render only if interaction required #22

Closed sgoodluck closed 1 year ago

sgoodluck commented 1 year ago

Using this library I noticed that if we set

<Turnstile
   ...
   options={{
     appearance: 'interaction-only',
    }}
/>

That the widget immediately vanishes on success.

Widget is invisible if no-interaction is required Widget becomes visible if interaction required Widget remains visible after interaction

marsidev commented 1 year ago

Hello @sgoodluck, I don't fully understand the issue or request here.

According to the docs, that's how it works when appearance is set to interaction-only; the widget will remain invisible until it requires manual interaction.

sgoodluck commented 1 year ago

That doesn't appear to be the case -- it looks as if as soon as a user interacts with it, the widget vanishes! However, I'm not sure if this is in your implementation or a bug in the base cloudflare code at this time

marsidev commented 1 year ago

Yes, that's intended.

Please see this codesandbox where I'm rendering two widgets; one is created by @marsidev/react-turnstile and the other is a vanilla widget (no libraries). Both have the same behavior.

sgoodluck commented 1 year ago

Roger -- will go upstream to cloudflare as that seems like a bug. Thank you for your work on this package!