• Hi, with hCaptcha turned on in a Kadence form, it forces the page to scroll to the hCaptcha location upon every load.

    i.e. you load the homepage, see the top of it for a second, then it autoscrolls to where hCaptcha is.

    This doesn’t happen when I deactivate hCaptcha.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter lukascech

    (@lukascech)

    and I don’t really want to add 3rd party code to fix something that the plugin shouldn’t be doing:
    https://stackoverflow.com/questions/72809723/hcaptcha-scrolls-to-top-on-invokation

    Thread Starter lukascech

    (@lukascech)

    the scroll happens automatically when using the EASY hCaptcha setting on https://dashboard.hcaptcha.com/. Switching to Auto stops the auto-scroll to it’s location, but when the visitor scrolls using the mouse, it jumps to the hCaptcha too.

    Thread Starter lukascech

    (@lukascech)

    I turned it off as I need to use the website mentioned above.

    Plugin Contributor kaggdesign

    (@kaggdesign)

    Thank you for reporting. First of all, the WordPress plugin does nothing with scrolling. It may be a side effect of the hCaptcha API script, but I do not have access to its code and just use it as is in the plugin.

    The EASY finding is valuable. I will try to reproduce the issue, and report it to hcaptcha.com.

    P.S. Could you create a similar page to see the effect? Thanks.

    • This reply was modified 1 week ago by kaggdesign.
    Thread Starter lukascech

    (@lukascech)

    here you go: https://www.jsadvokat.sk/hcaptcha-test/

    I have hidden hcaptcha on the homepage using CSS, so it doesn’t do that there, but that’s only temporary, I’ll remove this test page in about a week.

    Thread Starter lukascech

    (@lukascech)

    actually scratch that, silly me – it’s not enough to hide it using CSS, I would need to somehow unhook the script from the form as the form won’t send without the captcha check.

    As the website is live, I have deleted the captcha test page, because it was breaking the homepage too.

    Plugin Contributor kaggdesign

    (@kaggdesign)

    I tried to reproduce it locally, but no luck.

    Can you re-create a test page? You can turn off hCaptcha on your kontakt page following the instruction.

    In your case, you should add the following filter.

    /**
    * Filters the protection status of a form.
    *
    * @param string $value The protection status of a form.
    * @param string[] $source The source of the form (plugin, theme, WordPress Core).
    * @param int|string $form_id Form id.
    *
    * @return bool
    */
    function hcap_protect_form_filter( $value, $source, $form_id ) {
    if ( ! in_array( 'kadence-blocks/kadence-blocks.php', $source, true ) ) {
    return $value;
    }

    if ( 7 !== $form_id ) {
    return $value;
    }

    return false;
    }

    add_filter( 'hcap_protect_form', 'hcap_protect_form_filter', 10, 3 );

    This filter will block hCaptcha on kontakt page but let it work on any other test page.

    Thread Starter lukascech

    (@lukascech)

    thanks for the code, works fine, the test page is live again: https://www.jsadvokat.sk/hcaptcha-test/

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.