No Search Function on Mobile Devices

Home Forums Product Support Forums Ajax Search Pro for WordPress Support No Search Function on Mobile Devices

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39860
    Trent Bowen
    Trent Bowen
    Participant

    The search function does not work on the the mobile version. I checked using Safari and Chrome on my iphone. On the home page I tap on the search icon on the website https://aecontrol.us when I tap on the search no typing cursor or keyboard comes up on a mobile device. I can’t run a search using a mobile device.

    The computer works well.
    What can I do to make the search function work on mobile devices.

    Thanks,
    Trent Bowen

    #39861
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Trent,

    Thank you for the details, it helps a lot.

    The issue is unfortunately caused by the menu script. It has an event handler attached to the menu “touchstart” event, it is probably to programmatically handle the menu clicks on mobile devices. Unfortunately that event handler prevents further propagation and the “touch” does not get to the input field, as it is cancelled.

    When I remove the event handler from the menu it starts working, as you can see here (the input is focused).

    The best solution would be to use a different menu element, one that is made for shortcodes or other dynamic content.

    If that is not possible, then you can still try a custom code, which I quickly constructed to focus the search whenever the menu is clicked. Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    add_filter('wp_footer', 'asp_my_custom_script', 10);
    function asp_my_custom_script() {
      ?>
      <script>
      jQuery(function($) {
        jQuery('.ubermenu-submenu-id-10149').on('click touchstart', function(){jQuery(this).find('input.orig').get(0).focus()});
      });
      </script>
      <?php
    }

    After adding the code you will have to clear all caches, including the mobile devices.

    Unfortuantely I can not guarantee this is going to work in all cases, as the issue is not caused by the search plugin.

    Best,
    Ernest Marcinko

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


    #39868
    Trent Bowen
    Trent Bowen
    Participant

    That worked really well, thank you so much you are so kind. Every time I contact you, you are always willing to help, I can’t believe how nice you really are!

    God bless,
    Trent Bowen

    #39872
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.