Cursor Gets Lost after Magnifying Glass

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Cursor Gets Lost after Magnifying Glass

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
3 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20665

    Participant

    After clicking the magnifying glass icon, the search dialog box appears and you would expect to be able to start typing. However, you can’t start typing until you have clicked to place the cursor in the search field.

    I don’t see this issue in the demo. Do you know what I could do to correct this?

    Thanks!

    #20668

    Hi!

    The most likely cause is a 3rd party script, but it is usually very hard to determine which one exactly. I think the best solution in this case is to use a custom code to re-focus the input field once the results are finished displaying.

    Add this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_action('wp_footer', 'asp_refocus_input', 10);
    function asp_refocus_input() {
        ?>
        <script>
            jQuery(function($){
                $('.asp_m').on('asp_results_show', function(e, id, instance){
                    setTimeout(function(){
                        $('.asp_m_' + id + '_' + instance + ' input.orig').get(0).focus();
                    }, 200);
                });
            });
        </script>
        <?php
    }

    This should resolve the issue, by forcing the input focus.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.