Result suggestions appearing without click

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Result suggestions appearing without click

This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42390
    subgrafica
    subgrafica
    Participant

    Hi
    I’m using the plugin on my website to have two different search bars and each will search on a different category of pages.
    The thing is our client wants the search bar to only appear when clicking the name of a category, I have done this with my own code so that when you click on each category name the corresponding search bar appears.
    Also the result suggestions are enabled to show suggestions for the specific category.

    The problem is that on the first load of the page the result suggestions appear out of nowhere without the search bar. To be clear, both the search bar and the suggestions must remain hidden until you click on the name of a category.

    How can this be fixed?
    If you could point me to the settings for this, or maybe the file where this could be controlled then I can work on it myself.

    Here’s a video of the problem
    https://www.dropbox.com/s/k6366ubt63n84gv/Screen%20Recording%202023-05-08%20at%2013.56.40.mov?dl=0

    #42391
    subgrafica
    subgrafica
    Participant

    Hi again

    I wrote Result suggestions but I was referring to the Auto Populate option, that is what is appearing out of nowhere

    #42396
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I believe the best way to get around this issue is to programmatically trigger the search whenever it gets visible when the corresponding menu element is clicked.

    There is a code within the plugin to only initialize whenever the plugin gets “visible”, but that is very difficult to check properly – a javascript intersection observer is used, and those can mostly detect if an element is within the viewport, but the parent element visibilities are only considered invisible when an element is either not in the viewport or has a display:none property.

    Instead of relying on the proper intersection, I would recommend disabling the auto populate feature overall and instead of that using the javascript API to trigger an empty search whenever the corresponding menu element is clicked.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.