[Resolved] Search bar focus

Home Forums Support [Resolved] Search bar focus

Home Forums Support Search bar focus

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1183749
    Gianluca

    Hi,
    I have a problem with my search bar: when I click on the search icon, the search bar opens but the cursor is not displayed and if I try yo type someting to search it doesn’t work, but I have to click inside the search barr to be able to write someting.

    Please, can you help me?

    #1183795
    Leo
    Staff
    Customer Support

    Hi there,

    That’s weird. It should work like that by default as you can test it here:
    https://gpsites.co/marketer/

    Any chance you can disable all plugins except GP Premium to eliminate conflicts from other plugins first?

    Make sure you are using the parent theme with no custom CSS or functions added as well.

    Let me know πŸ™‚

    #1183817
    Gianluca

    Hi Leo,
    thank you for your replay.

    I found the problem: is the function “generate_smooth_scroll_elements” that, when enabled, causes the bug in the search bar. I’m using the code that I found on your site here https://docs.generatepress.com/article/generate_smooth_scroll_elements/

    I need this function, but I need also that the search bar work properly.

    How can I fix the error?

    #1183847
    David
    Staff
    Customer Support

    Hi there,

    not sure if this will work but try this code:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
      $elements[] = 'a[href*="#"]:not([aria-label*="Apri"])';
      
      return $elements;
    } ); 
    #1183882
    Gianluca

    Hi David,
    I replaced :not with .not and it worked.

    Tank you very much!

    #1183922
    Gianluca

    Sorry but with .not while now the search bar work, all the smooth scroll links on my website don’t work anymore.

    However with :not the smooth scroll links work but the search bar not. πŸ™

    Do you have any other suggestions for me?

    TY.

    #1184184
    Tom
    Lead Developer
    Lead Developer

    You may need to be more specific with your targeting.

    For example, if the links you’re targeting are in the content area, you can do this:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
      $elements[] = '.entry-content a[href*="#"]';
      
      return $elements;
    } ); 
    #1185494
    Gianluca

    Thank you Tom, it works well.

    But if I want to add the links positioned in other zone of the site (for example in the .page-hero), how can I add a second position?

    #1186057
    Tom
    Lead Developer
    Lead Developer

    Try this:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
      $elements[] = '.entry-content a[href*="#"]';
      $elements[] = '.page-hero a[href*="#"]';
      
      return $elements;
    } ); 
    #1186074
    Gianluca

    Thank you Tom, it works very well!

    #1186084
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

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