Matteo
Matteo

Reputation: 11

Javascript, Android and Chrome in industrial devices: enter key not firing event keyup and keydown in input text fields

Recently I updated the Chrome to version 106 in some industrial devices working with Android. These devices works with web pages developed with PHP and Javascript routines. Now I show you the problem with this simply example:

<html>
<body>
FIELD 1 <input type="text" id="campo1" name="campo1" onkeyup="testRoutine('FIELD 1', event);"><br>
FIELD 2 <input type="text" id="campo2" name="campo2" onkeyup="testRoutine('FIELD 2', event);"><br>
FIELD 3 <input type="text" id="campo3" name="campo3" onkeyup="testRoutine('FIELD 3', event);"><br>

<script>
function testRoutine(name, event)
{
    alert(event.keyCode);
    if (event.keyCode == 13)
    {
        alert("KEY ENTER PRESSED ON "+name);
    }
}
</script>
</body>
</html>

I focus the first field and i press enter on the virtual keyboard of my devices: the result is the browser go to the next field and not fire the onkeyup event... no keyCode is showed. So i trying the same thing pressing enter in the second field and the browser focus the third field without run the testRoutine. In the last field i press enter and the browser launch the testRoutine correctly! In the previous chrome version (70) this problem not exists: the first field fires correctly the onkeyup event with the enter key.

Notice: only the enter key not fires the onkeyup event, other keys fires the event correctly but the keycode is always 229...

I want to trigger always the enter key in any fields of my web page. Have you any suggestion? Thank you very much

Matteo

Upvotes: 1

Views: 484

Answers (0)

Related Questions