FriendlyCaptcha / friendly-captcha-wordpress

WordPress plugin for Friendly Captcha. Protect WordPress website forms from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
https://friendlycaptcha.com
19 stars 9 forks source link

Use MutationObserver to setup widgets that are added after the initial load #83

Closed merlinfuchs closed 8 months ago

merlinfuchs commented 1 year ago

Some customers had problems with widgets not loading correctly when they are dynamically added (e.g. in a modal). This is because we only call setup once on page load. Usually a customer would use our JavaScript library to setup the widgets themselves, but this doesn't really make sense for wordpress. To solve this we could use a MutationObserver to listen for newly added HTML elements. I'm not sure about the performance if we are listening for DOM changes globally so there probably should be a way to turn it off in the settings.