New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 763559 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

KeyboardEvent.key returning undefined

Reported by andrejoh...@gmail.com, Sep 8 2017

Issue description

Steps to reproduce the problem:
1. Open page in Android Chrome
2. Type into text area
3. 

What is the expected behavior?
The characters typed should appear in the ouput, as value for event.key , when 'keydown' event is handled.

What went wrong?
Undefined appears for each character, as value for event.key

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 60  Channel: stable
OS Version: 7
Flash Version: 

Not an issue on Chrome 60 on MacOS X. Tested with other Android devices and same issue is apparent. Not an issue when used the desktop keyboard, while using USB tethered debugging and inspecting in desktop Chrome.
 
event-key-testcase.html
481 bytes View Download
Labels: Needs-triage-Mobile
Cc: changwan@chromium.org hua...@chromium.org
Components: UI>Input>Text
Labels: -Needs-triage-Mobile Needs-Feedback
Hello

Thanks for reporting the issue. We were able to repro this issue on Nexus5X/N2G48E, on Chrome: 60.0.3112.116 & also on system image:55.0.2883.91. Can you please let us know if this ever worked on any Chrome version?

Logs & screenshot @ http://go/chrome-androidlogs1/7/763559
I have only recently discovered this issue and had not previously tested this functionality on Android. For this reason, I am not aware if it worked on any Android based Chrome version.
Project Member

Comment 4 by sheriffbot@chromium.org, Sep 8 2017

Cc: ppolise...@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "ppolisetty@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Unconfirmed)
Cc: -changwan@chromium.org rlanday@chromium.org aelias@chromium.org
Owner: changwan@chromium.org
Status: WontFix (was: Available)
This is WAI - please check  issue 118639  for more details.
You can try oninput / onchange if you want to capture typing events for virtual keyboards.

For anyone else reading this, the TL;DR explanation is that the issue is due to a limitation of the soft keyboards on Android and not a limitation within Chromium.

At the same time, since characters are appearing in the text field, what is telling the input field what characters it should adding? Is the text field an OS component or something provided by Chrome?

Comment 8 by rlanday@google.com, Sep 9 2017

Text fields inside a web page are implemented by Chrome (the system TextView is not used). This documentation describes the API used by Android IMEs to send text to an application (including Chrome):
https://developer.android.com/guide/topics/text/creating-input-method.html
So if Chrome is implementing the adding of characters to the text field, surely it could provide a way to filling the KeyboardEvent.key value, even if via emulation?

Further testing reveals that onInput and onChange are not good alternatives to onKeyDown, at least in our scenario. The issue being if we need to handle characters typed, then while printable characters can be captured with onInput, other special keys such as tab and enter are ignored. onChange only provides the new state of the field.

I am reluctant to use KeyboardEvent.keyCode since that is deprecated, as is KeyboardEvent.charCode. Without proper support for KeyboardEvent.key, onKeyDown essentially is useless on Android Chrome. Is that an acceptable end state for this issue? 



event-key-testcase-b.html
1000 bytes View Download

Comment 10 by phistuck@gmail.com, Sep 10 2017

#9 - I do not remember for sure whether Chrome implemented it or not, but will the "beforeinput" help here?
Testing in desktop Chrome, I see beforeinput is implemented, but not fired for tab key or any other not-printing key. It does fire for the enter key.

Comment 12 by phistuck@gmail.com, Sep 10 2017

#11 - I guess it makes sense, because the tab key does not type anything, right?
There are composition events, but I do not know whether they are implemented, or whether they are helpful for your use case. Probably not (tab is not composing anything).

Sign in to add a comment