Closed kungtiger closed 9 years ago
Hi, I've had autofocus enabled in the beginning, but can't really remember why I dropped it later. I think the reason was that on tablets it would zoom in everytime the search box gets focussed on page load.
Will have a look at it later when I have my tablet at hands to check that.
Ah, I see. Since you are using jQuery, maybe add autofocus only for non-mobile. Something along the line:
jQuery(function(){
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
if (!isMobile.test(navigator.userAgent)) {
jQuery('#wpsearchterm').trigger('focus');
}
});
Note: I have not tested the snippet.
Okay, autofocus is back in for all devices. No zooming, no keyboards popping up on tablets. All fine. :)
Does this include regular desktop screens? I didn't mentioned it before, but I'm using a regular old-school laptop and I've just checked wpseek and there is no autofocus.
Dangit. Forgot to wipe the server-side cache. Please try again. :)
Shezaam! Here we go! Thanks man, that makes life easier!
First of all: Your API seach engine is great! I use it nearly daily. Just a small suggestion. Could you maybe autofocus the search box on page load? It's just a matter of adding autofocus="autofocus" to the seach box. Thanks!