Device-Bugs
Device-Bugs copied to clipboard
Chrome Beta (Mobile): keypress event not supported
According to my testing (on a Galaxy Nexus running ICS), the keypress event doesn't seem to be supported on Chrome Beta for Android. Changing to keydown worked, but keydown doesn't unfortunately give nearly the detail that keypress does for event.which.
This bug report applies to Chrome desktop but the issue is the same I believe: http://code.google.com/p/chromium/issues/detail?id=2606
keypress on the default Android ICS (and older version) browser does work.
What does a keypress mean on a mobile browser? If you are serious about this, please log a bug on new.mcrbug.com.
Perhaps this bug should actually be called event.which is undefined in keydown event (Not that I've confirmed this is the case)
Actually event.which is always 0 (on nexus S, Android 4.0 and upwards at least).
Problem documented here and here. http://productforums.google.com/forum/#!topic/chrome/H-K8-MiQApM http://code.google.com/p/chromium/issues/detail?id=118639
I was confused at first that Google doesn't support such a common event as keypress. But then I found in the specification that this event is deprecated and beforeinput should be used instead. See http://www.w3.org/TR/DOM-Level-3-Events/#event-type-keypress
@bjoerne2 What is beforeinput? I get shockingly few results trying to Google for a practical example of how to use it. I assume the handler is actually named "onbeforeinput"? When I try assigning a function to "window.onbeforeinput" it never gets called.
@michael-ts I can't create a valid example either. I overlooked that the spec I mentioned is a draft. It still says that beforeinput should be used, but we'll see if this is still true when the spec will be finally released. At the moment beforeinput doesn't seem to be a good solution.