This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Input Search Field Won’t Focus After Click Magnifying Glass – 2.0

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Input Search Field Won’t Focus After Click Magnifying Glass – 2.0 Reply To: Input Search Field Won’t Focus After Click Magnifying Glass – 2.0

#54506
Ernest MarcinkoErnest Marcinko
Keymaster

That will not fix the issue, it is unrelated to the spinner. This is again caused by a 3rd party script, so I can’t guarantee anything. Normally the plugin does not blur the focus when displaying the results.

Try this variation:

add_action('wp_footer', function () {
	?>
	<script>
		const f = ( select = false ) => {
			let input = document.querySelector('.dialog-widget .asp_m input.orig');
			if ( input === null ) {
				return;
			}
			input.focus();
			if ( select ) {
				input.setSelectionRange(0, 9999);
			}

		}
		jQuery(document).on('elementor/popup/show', ()=>{
			setTimeout(()=>{f(true);}, 800);
			document.querySelectorAll(".asp_main_container").forEach((el) => {
				el.addEventListener("asp_search_end", () => {
					setTimeout(()=>{f();}, 500);
				});
			});
		});
	</script>
	<?php
}, 999999);

But again, this is just patching over and over something that may change and cause the conflict to appear again. It would be the best to find what the cause is.