-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyboard events do not behave as expected on mobile #6176
Comments
Can you provide a jsfiddle that demonstrates the issue. Also, some of these things surprise me (event.keyCode is always 229, event.charCode is always 0, event.which is always 229), can you verify that the native event is correct (eg. native |
@jimfb here is a jsfiddle with both syntheticEvent and native event : https://jsfiddle.net/rzpwd77y/38/ Well, well, well... I had not tried the native event yet and it appears that it's not triggered at all on mobile. (on mine at least.) But the React SyntheticEvent is triggered once, with the values Unidentified and 229. Anyway, It seems that this is not really a bug on React side since the native event is not event triggered. Although the behavior of the syntheticEvent is weird then. I have to understand why I have a mobile not triggering keyboard events and how to handle it... I should not be the only one.. |
I agree, the behavior of the synthetic event sounds weird, given that the other events are not firing. This is probably a weird side effect of some event api smoothing that we're doing (and apparently we have a bug there that is causing nonsensical events to be fired). I tried your fiddle on my android (different model/version) and did not get any of the mysterious synthetic events (at least as far as I can tell, I got no events on the android). I don't have a phone matching the specs you mentioned, so it's a bit difficult for me to debug further on my end. If you're able to debug on your end and submit a PR, that would be much appreciated! |
I have the same phone and specs as @VictorienTardif (Nexus 5, 6.0.1, chrome 48.0.2564.95) and got the same results as @jimfb: no native or synthetic events fired when typing |
@jimfb @jquense I don't know why but now I see no event either. Not even the synthetic event with 229 and 0 that I used to see. So, the behavior seems to be "normal" : no native event = no synthetic event. The remaining question is why don't we have an event? I did a pure html / javascript fiddle to see if I can handle events : https://jsfiddle.net/fdm3r1vv/6/ The thing is, the keyDown event is triggered but the keyPress event is not. Anyway, I have an event! |
This is starting to sound increasingly like a browser quirk rather a bug in the React core. I suppose one question remaining is: Is this an API quirk that we want to smooth out? |
This is unactionable in its current state. As of March, it looks like a browser quirk, and it is not clear that we want to smooth it. If we decide that we want to smooth it out, we can reopen. In the meantime, closing as unactionable, since it doesn't appear to be a bug in React. |
(tested on Google Nexus 5, Android 6.0.1, Google Chrome 48.0.2564.95)
The text was updated successfully, but these errors were encountered: