Unexpected scrolling after same page anchor link is clicked

  • connect
    Participant
    2 months ago #45827

    Hi WPSolr,

    We have an issue that is affecting one of our clients which we believe you may be able to help us with. They are using your WPSOLR PRO plugin (version 23.8) on their WordPress site (version 6.6.1), and are getting an issue when clicking anchor links that link to an anchor point in the same page (e.g. #my-id).
    It looks like after clicking these anchor links, anytime you try to scroll away from the anchor it will scroll you back to it on a short delay.
    When trying to diagnose the issue, we noticed that if we removed an event listener from your plugins code, the issue went away. It looks like its listing to the popstate event and is registered in the script /wp-content/plugins/wpsolr-pro/wpsolr/core/js/autocomplete_solr.js?ver=23.8.
    This issue seems to affect chrome but not firefox.
    We are also getting some errors in the console. (I have replace the site url with SITE_DOMAIN)
    `
    jquery-migrate.min.js?ver=3.4.1:2 JQMIGRATE: Migrate is installed, version 3.4.1
    jquery.min.js?ver=3.7.1:2 jQuery.Deferred exception: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (SITE_DOMAIN/wp-content/plugins/wpsolr-pro/wpsolr/core/js/autocomplete_solr.js?ver=23.8:444:91)
    at Function.each (SITE_DOMAIN/wp-includes/js/jquery/jquery.min.js?ver=3.7.1:2:3129)
    at HTMLDocument.<anonymous> (SITE_DOMAIN/wp-content/plugins/wpsolr-pro/wpsolr/core/js/autocomplete_solr.js?ver=23.8:436:11)
    at e (SITE_DOMAIN/wp-includes/js/jquery/jquery.min.js?ver=3.7.1:2:27028)
    at t (SITE_DOMAIN/wp-includes/js/jquery/jquery.min.js?ver=3.7.1:2:27330) undefined
    ce.Deferred.exceptionHook @ jquery.min.js?ver=3.7.1:2
    t @ jquery.min.js?ver=3.7.1:2
    setTimeout (async)
    (anonymous) @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    fire @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    ready @ jquery.min.js?ver=3.7.1:2
    P @ jquery.min.js?ver=3.7.1:2
    jquery.min.js?ver=3.7.1:2 Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (autocomplete_solr.js?ver=23.8:444:91)
    at Function.each (jquery.min.js?ver=3.7.1:2:3129)
    at HTMLDocument.<anonymous> (autocomplete_solr.js?ver=23.8:436:11)
    at e (jquery.min.js?ver=3.7.1:2:27028)
    at t (jquery.min.js?ver=3.7.1:2:27330)
    (anonymous) @ autocomplete_solr.js?ver=23.8:444
    each @ jquery.min.js?ver=3.7.1:2
    (anonymous) @ autocomplete_solr.js?ver=23.8:436
    e @ jquery.min.js?ver=3.7.1:2
    t @ jquery.min.js?ver=3.7.1:2
    setTimeout (async)
    ce.readyException @ jquery.min.js?ver=3.7.1:2
    (anonymous) @ jquery.min.js?ver=3.7.1:2
    e @ jquery.min.js?ver=3.7.1:2
    t @ jquery.min.js?ver=3.7.1:2
    setTimeout (async)
    (anonymous) @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    fire @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    t @ jquery.min.js?ver=3.7.1:2
    setTimeout (async)
    (anonymous) @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    fire @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    ready @ jquery.min.js?ver=3.7.1:2
    P @ jquery.min.js?ver=3.7.1:2
    `

    If I remove that event listener in my browser the issue stops happening. I do this by opening development tools, open the element tab, click on an element, and in the right hand panel click the events listeners tab and remove the popstate listener from autocomplete_solr.js?ver=23.8:136.

    Do you know what steps we can take to resolve this issue?

    Any help much appreciated.

    Thanks,
    Connect

    wpsolr
    Keymaster
    connect
    Participant
    1 month, 3 weeks ago #45837

    Thanks for getting back to me. Reading through that thread you recommend,

    It should only happen when the ‘(Deprecated) Use WPSOLR custom Ajax search templates’ search template option is selected on screen 2.1
    If you can, you should switch to your own theme archive loop template instead.

    Which when looking I can’t see that option anywhere. I tried toggling the “Replace front-end archives” options (under Define your search -> Search) to toggle them all off, but that didn’t seem to make a difference. Please can you let me know if i’m looking in the wrong place?

    If it helps, the scroll issue is happening on a standard page, not the search results page.

    Thanks for your help!

    wpsolr
    Keymaster
    1 month, 3 weeks ago #45838

    The conclusion of the original thread was that it is apparently related to a Chrome bug, irrespective of the settings you choose in WPSolr.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.