verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 73 forks source link

Load recaptcha when user interacts with form #1119

Closed danfathom closed 2 months ago

danfathom commented 2 years ago

What are you trying to do?

It would be great if there was option in Formie to only load recaptcha once the user interacts with a form. Google lighthouse always shows loading Google recaptcha as something that slows down the page load (mainly on mobile) due to the JS file being around 150kb.

This is a feature on Freeform and would be great to have the ability to do this on Formie too.

What's your proposed solution?

Add a script, to only load the google recaptcha JS file once the user interacts with the first required field on a form.

Additional context

No response

engram-design commented 2 years ago

Sounds like a good idea, thanks!

danfathom commented 1 year ago

Hi, I don't suppose you have any plans to implement this feature in the near future? :)

engram-design commented 1 year ago

We certainly do, yes, but no ETA. Likely in 2.1 early next year.

danfathom commented 1 year ago

Ok sounds great, thanks!

darylknight commented 11 months ago

Chipping in my desire for this too :) Having the recaptcha thing show up on every page of the site is annoying.

danfathom commented 8 months ago

Hi,

Just re-visiting this - is there any plan to include this feature in the near future? We use google re-captcha on our sites, and it's size is 385.5KiB, which is negatively impacting our google lighthouse page speeds.

Thanks

engram-design commented 8 months ago

It's 100% on our radar, and will be implemented in Formie 3 for Craft 5. In fact, this is already available in the craft-5 branch. We'll look to back-port this to Craft 4 if there's demand for this but it will be after our Craft 5 work.

In addition, Formie 3 will also not initialize its JS until the form is visible, bringing even further improvements.

darylknight commented 8 months ago

That second part will be super awesome. We have a site that has a contact form in the footer of every page, so not initialising the JS until you scroll down will be a big deal :)

hassanmah commented 6 months ago

@engram-design hey Josh, I second that. Are there any updates on back-porting to Craft 4 yet? We have a quote form on every page, Lighthouse reports Captcha is the biggest culprit

engram-design commented 6 months ago

I’m hesitant to backport it as-is without it being a breaking change, so might have to enable the behaviors behind a flag.

I’ll look into it.

WHITE-developer commented 2 months ago

+1, we would also really love to have the lazy recaptcha for Craft 4 as we are loading a newsletter form on every page.

engram-design commented 2 months ago

Added in 3.0.0