KeyboardEvent.key returning undefined
Reported by
andrejoh...@gmail.com,
Sep 8 2017
|
|||||
Issue descriptionSteps 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.
,
Sep 8 2017
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
,
Sep 8 2017
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.
,
Sep 8 2017
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
,
Sep 8 2017
,
Sep 9 2017
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.
,
Sep 9 2017
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?
,
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
,
Sep 10 2017
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?
,
Sep 10 2017
#9 - I do not remember for sure whether Chrome implemented it or not, but will the "beforeinput" help here?
,
Sep 10 2017
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.
,
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 |
|||||
Comment 1 by ligim...@chromium.org
, Sep 8 2017