Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-keypress does not work on Google Chrome Android browsers #5298

Open
evgenyneu opened this issue Dec 5, 2013 · 16 comments
Open

ng-keypress does not work on Google Chrome Android browsers #5298

evgenyneu opened this issue Dec 5, 2013 · 16 comments

Comments

@evgenyneu
Copy link

Hi, ng-keypress directive does not fire on Google Chrome Android browsers.

Demo: http://plnkr.co/edit/hmCFceDC3CwMbci5SWCe?p=preview

Tested Google Chrome versions 28, 29 and 31 on Android 4.0.3 and 4.3.
AngularJS version is 1.2.3

Note: Directive ng-keydown works. Older stock Android browser Chrome v11 works as well.

Thank you

@ghost ghost assigned tbosch Dec 5, 2013
@caitp
Copy link
Contributor

caitp commented Dec 5, 2013

Seems to work on my android 4.1.2's webview

@tbosch
Copy link
Contributor

tbosch commented Dec 5, 2013

Hi,
as I don't have an Android device with Chrome on Android installed here, could anyone else verify and analyze the reason for this? Maybe @caitp?

Thanks!
Tobias

@caitp
Copy link
Contributor

caitp commented Dec 5, 2013

@evgenyneu what device are you seeing this with? Do you see an initial keypress feedback but not subsequent ones? Are you using a different input method like Swype?

I don't have a very good testing environment to really dig into what's happening at this second, but for me I'm seeing the updated value each touch (with native input method) and on the initial touch (with swype)

@tbosch
Copy link
Contributor

tbosch commented Dec 6, 2013

@caitlin: The problem seems the be when using Chrome on Android, not the
default WebView...

On Thu, Dec 5, 2013 at 3:33 PM, Caitlin Potter [email protected]:

@evgenyneu https://github.com/evgenyneu what device are you seeing this
with? Do you see an initial keypress feedback but not subsequent ones? Are
you using a different input method like Swype?


Reply to this email directly or view it on GitHubhttps://github.com//issues/5298#issuecomment-29950029
.

@caitp
Copy link
Contributor

caitp commented Dec 6, 2013

I've tested both, as the original issue said it occurred in both --- Both with webkit 534 in the UA string


edit: interestingly with 537 it doesn't work as reported, hmm. I can try to figure out what event it is emitting. It would be interesting to see if using ngTouch solves the issue, as well

The expression doesn't seem to be evaluated for any of the ngEventDirs events, with or without ngTouch :( I don't think I"m going to figure out exactly why not tonight though, I'll look at it tomorrow if nobody else has found it

@evgenyneu
Copy link
Author

@caitp I am seeing this issue on Samsung Galaxy Note III and HTC Velocity 4G. There is no initial or subsequent feedback. Nothing at all. I am not using different input methods, using the default.

@evgenyneu
Copy link
Author

@caitp ng-keypress does work on stock Android browser on Android 4.0.3 for me. But not in Google Chrome on the same device. On Samsung Android 4.3 it does not work neither on stock nor Chrome.

@davgothic
Copy link

I can confirm that this problem is also occurring in the new Chrome 30 based WebView on Android devices running 4.4 (KitKat). Tested using angular version 1.2.0 and 1.2.3.

@caitp
Copy link
Contributor

caitp commented Dec 6, 2013

Yeah as I said, builds using older versions of "webkit" (was chrome still webkit or did it already fork in 534?) it seems to work (for me), but after updating Chrome I am seeing your problem... I'm going to investigate that a bit further today, because it appears that similar issues have popped up on stack overflow and rietveld over the past year

@caitp
Copy link
Contributor

caitp commented Dec 6, 2013

https://gist.github.com/caitp/1f40ff2c3163ecb00d8a I started a gist with links to test cases yesterday...

So the Angular 1.2.4 test (not using ng-model) provides feedback (for me) for focus, blur, keyup, keydown, input, compositionstart, compositionupdate (but never compositionend, interestingly) --- I am not getting keypress, which would account for this bug (I don't think I'm getting it in jQuery either...)

So, there are two problems, 1) is compositionend never appearing, and 2 is the apparent inability to receive keypress

edit

I actually do see compositionend very rarely (but I'm not using a CJK IME, but Swype is very buggy and this probably explains a lot of bugs I see using it :z) --- I never see any composition events without Swype, so whew. But yeah, no keypresses, only keydown/keyup/input

@caitp
Copy link
Contributor

caitp commented Dec 6, 2013

With the most recent addition to those tests, http://plnkr.co/edit/RJykPShOHSr0nUNjXRRW?p=preview,

it appears that even with ng-model, most of these events are being triggered (once again, never getting keypress in Chrome on Android, regardless of jqLite or jQuery, ngModel or not)

So... I don't think emulating the keypress event is a very good idea... but maybe your own app could do that, if it needs to...

Might be worth opening an issue on blink rietveld though maybe

@caitp
Copy link
Contributor

caitp commented Dec 16, 2013

Hey good news, I think I have a solution that might actually work! http://plnkr.co/edit/euPnjrLk918G31aTDPjN?p=preview In testing on my Nexus, with and without Swype, I get pretty good results.

But it would be cool if someone could try this with a CJK IME just so that I can be sure it doesn't break international input.

I'll submit a PR for this, but I'm not totally sure how to write an automated test for this.

@ghost ghost assigned tbosch Dec 18, 2013
@perrygovier
Copy link

It appears that in current versions of Chrome for Android, and now with KitKat replacing the native browser, that too, that the onkeypress event does not fire at all. Does this fit everyone else's findings?

@btford btford removed the gh: issue label Aug 20, 2014
@casank25
Copy link

It's being suggested to use 'beforeinput' event instead of keypress. Newer versions of android (I believe starting 4.4.2) are dropping keypress event as this event is getting deprecated. See here: http://www.w3.org/TR/DOM-Level-3-Events/#event-type-keypress. So my guess is that android just chose not to support it anymore.

@ibanezje
Copy link

ibanezje commented Oct 2, 2014

Well 'beforeinput' is not supported or doesn't work in 4.4.2 WebView.
Although my usecase is window.onkeydown.
It fires allright, but the KeyBoardEvent gives mostly zeros on the charCode property.
So am I correct, this issue is here for almost a year?
Anyone know of a workaround, this is a showstopper for me on android kitkat.

@petebacondarwin petebacondarwin modified the milestones: Backlog, ngTouch Overhaul Jan 26, 2016
@Narretz
Copy link
Contributor

Narretz commented Jan 26, 2016

@petebacondarwin I don't think this is in the scope of ngTouch.

@Narretz Narretz modified the milestones: ngTouch Overhaul, Backlog Sep 14, 2016
@Narretz Narretz removed the PRs plz! label Apr 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants