• Resolved Mister OBM

    (@mrobm)


    We have a pop out menu created with elementor and have the fibosearch bar at the top of the menu. Everything works great but as soon as you open the menu the keyboard pops up. Is it possible to override this behaviour and stop it from autofocusing on the search bar?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Kris

    (@c0nst)

    Hi @mrobm

    Here is a code snippet that will remove focus from FiboSearch input when the popup is shown and the device is mobile (screen width less than 992px).
    You need to check and change the ID from 102 to your popup ID in the below code. ID can be found in WP Admin -> Templates -> Popup in shortcode.

    // Remove FiboSearch focus on input after Elementor Popup Show event
    add_action( 'wp_footer', function() { ?>
    	<script type="text/javascript">
    		jQuery( document ).on( 'elementor/popup/show', ( event, id, instance ) => {
    			var isMobile = jQuery(window).width() <= 992;
    			
    			if ( id === 102 && isMobile ) {
    				jQuery('.js-dgwt-wcas-enable-mobile-form').trigger('click');
    
    				setTimeout(function() {
    					jQuery('.dgwt-wcas-search-input').blur();
    				}, 100);
    			}
    		} );
    	</script>
    <?php }, 9999 );de.

    You have two ways to add this code to your theme:

    1. Open the functions.php in your child theme and add the code at the end.
    2.  or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    Thread Starter Mister OBM

    (@mrobm)

    Hi Kris, thanks for the reply, I put the code into the functions.php but it’s giving me this error:
    syntax error, unexpected end of file

    Plugin Support Kris

    (@c0nst)

    Hi @mrobm

    I accidentally added an extra text at the end during the coping. Sorry for that. Here is the correct code:

    // Remove FiboSearch focus on input after Elementor Popup Show event
    add_action( 'wp_footer', function() { ?>
    	<script type="text/javascript">
    		jQuery( document ).on( 'elementor/popup/show', ( event, id, instance ) => {
    			var isMobile = jQuery(window).width() <= 992;
    			
    			if ( id === 102 && isMobile ) {
    				jQuery('.js-dgwt-wcas-enable-mobile-form').trigger('click');
    
    				setTimeout(function() {
    					jQuery('.dgwt-wcas-search-input').blur();
    				}, 100);
    			}
    		} );
    	</script>
    <?php }, 9999 );

    Regards,
    Kris

    Thread Starter Mister OBM

    (@mrobm)

    @c0nst thank you very much, that seems to have done the trick ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Stop autofocus on slide out menu’ is closed to new replies.