Device-Bugs icon indicating copy to clipboard operation
Device-Bugs copied to clipboard

Chrome Beta (Mobile): keypress event not supported

Open rbdcti opened this issue 12 years ago • 6 comments

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.

rbdcti avatar Apr 10 '12 15:04 rbdcti

What does a keypress mean on a mobile browser? If you are serious about this, please log a bug on new.mcrbug.com.

borismus avatar Apr 21 '12 03:04 borismus

Perhaps this bug should actually be called event.which is undefined in keydown event (Not that I've confirmed this is the case)

paulirish avatar Jun 08 '12 20:06 paulirish

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

Narsil avatar Jul 25 '12 16:07 Narsil

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 avatar Feb 11 '14 06:02 bjoerne2

@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 avatar Sep 17 '14 03:09 michael-ts

@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.

bjoerne2 avatar Sep 17 '14 04:09 bjoerne2