Android browser timers when the keyboard is open

I ran into this problem when asynchronous functions are not executed when the soft keyboard is open in Android browser.

For instance:

<input type='text' id='foo'/> .... document.getElementById("foo").addEventListener("keyup", function() { window.setTimeout(function() { alert("1"); }, 20); }, false); 

You will never see a warning as long as you focus on typing. This is also true for xhr callbacks. If you try to execute an ajax request, the request is sent, but the partial callback never starts until you type another character in the text box.

Does anyone know a workaround? You can see that Google obviously has a working example with their search suggestions, although I still could not understand what exactly their solution is by looking at a minified / confusing source.

Any insight appreciated, thanks

+4
source share
1 answer

Using the latest style jquery lib

 $("#inputnum").keyup(function(e){ if (e.keyCode != '13') { $("#outputarea").slideUp('slow'); }; }); 

causes the item selected with "#outputarea" to be reset every time - as soon as I type any letter on the software keyboard or hardware keyboard. Maybe you want to make jquery lib? Browser compatibility is the main reason I keep coming back to it.

0
source

Source: https://habr.com/ru/post/1338361/


All Articles