You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
When the Turnstile field becomes hidden and then visible again (e.g., switching tabs, collapsing panels, or dynamic content changes),
the Cloudflare Turnstile widget is destroyed and doesn't re-initialize, leaving users unable to complete the captcha.
Solution:
Added an IntersectionObserver to detect when the Turnstile container enters the viewport and automatically re-renders the widget if
it's missing. Includes a safety check to ensure the Turnstile API is loaded before attempting to render.
Changes:
- Added IntersectionObserver in the Alpine.js x-init to monitor element visibility
- Added window.turnstile check to prevent rendering before API loads
- Added element existence check before observing
Testing:
- Place Turnstile field in collapsible content or tabs
- Hide and show the container multiple times
- Verify captcha re-appears and functions correctly
0 commit comments