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

Issue 662372 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Some KeyboardEvent.key mapping are different from Firefox

Reported by dtoybo...@gmail.com, Nov 4 2016

Issue description

Steps to reproduce the problem:
When I investigate KeyboardEvent.key mapping on Android from the source code, some values whose mapping are not suggested by the spec are different from Firefox.

What is the expected behavior?

What went wrong?
virtual keycode	Gecko	Chromium

AKEYCODE_SWITCH_CHARSET (95)	"ModeChange"	"Unidentified"

"ModeChange" is declared as "The Mode Change key, to toggle between or cycle through input modes of IMEs.", and KEYCODE_SWITCH_CHARSET is explained as "Key code constant: Switch Charset modifier key. Used to switch character sets (Kanji, Katakana)". I understood the explanation as "changing keyboard layout", but if the keycode doesn't mean it, Firefox should change it to "Unidentified".

AKEYCODE_FORWARD (125)	"BrowserForward"	"MediaSkip"

KEYCODE_FORWARD is explained as "Key code constant: Forward key". Although, this is very unclear. However, when I connect keyboard to Nexus 7 (2013), BrowserForward key generates this keycode. So, I think that Chromium should use "BrowserForward" same as Firefox.

AKEYCODE_NUMPAD_ENTER (160)	"Enter"	"Unidentified"

Although, I cannot reproduce this odd mapping actually with Google Chrome. Perhaps, DomKey::FromCharacter() or something called in DomKey GetDomKeyFromAndroidEvent() solves this, but looks like that it should be mapped in GetDomKeyFromAndroidKeycode() explicitly.

AKEYCODE_BOOKMARK (174)	"BrowserFavorites"	"Unidentified"

Although, I cannot test this because I don't find keyboard which can generate this keycode actually yet. However, the explanation of this keycode is, "Key code constant: Bookmark key. On some TV remotes, bookmarks content or web pages.". So, this should be mapped to "BrowserFavorites".

AKEYCODE_LANGUAGE_SWITCH (204)	"GroupNext"	"Unidentified"

The explanation is, "Key code constant: Language Switch key. Toggles the current input language such as switching between English and Japanese on a QWERTY keyboard. On some devices, the same function may be performed by pressing Shift+Spacebar." So, I think that this should be mapped to "GroupNext" because ISO_Next_Group keysym on Linux works as so.

AKEYCODE_MUHENKAN (213)	"NonConvert"	"Unidentified"
AKEYCODE_HENKAN (214)	"Convert"	"Unidentified"

These keys are "無変換" and "変換" keys of JIS keyboard and they actually cause these keycodes. So, Chromium should use them.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version:   Channel: n/a
OS Version: 
Flash Version:
 
Cc: dtapu...@chromium.org
Labels: Hotlist-Input-Dev
Owner: chongz@chromium.org
Status: Assigned (was: Unconfirmed)
This seems simple enough can we get this fixed before M56 branches?
Cc: garykac@chromium.org
garykac@ do you agree we should change AKEYCODE_FORWARD (125) to be BrowserForward?

The rest seem fine to me.
fine to me = fine to change to match Gecko that is.
Status: Started (was: Assigned)
Project Member

Comment 6 by bugdroid1@chromium.org, Nov 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c7c76532cc8698c31c622c3340fd0b33ec0d36e3

commit c7c76532cc8698c31c622c3340fd0b33ec0d36e3
Author: chongz <chongz@chromium.org>
Date: Thu Nov 10 20:22:32 2016

[Android DomKey] Fix 7 key mappings to match FF

This CL maps the following keys:

AKEYCODE_SWITCH_CHARSET  (95)   =>  "ModeChange"
AKEYCODE_FORWARD         (125)  =>  "BrowserForward"
AKEYCODE_NUMPAD_ENTER    (160)  =>  "Enter"
AKEYCODE_BOOKMARK        (174)  =>  "BrowserFavorites"
AKEYCODE_LANGUAGE_SWITCH (204)  =>  "GroupNext"
AKEYCODE_MUHENKAN        (213)  =>  "NonConvert"
AKEYCODE_HENKAN          (214)  =>  "Convert"

See bug for more detailed explanations.

TEST=Manual
1. On Android go to https://cdn.rawgit.com/w3c/uievents/gh-pages/tools/key-event-viewer.html
2. Focus input field
3. Run command "adb shell input keyevent 95", etc
4. Verify produced "key"

Alternatively we can add tests in
"web_input_event_builders_android_unittest.cc", but I'm not sure how useful it would be since it's just a static map.

BUG= 662372 

Review-Url: https://codereview.chromium.org/2481033007
Cr-Commit-Position: refs/heads/master@{#431337}

[modify] https://crrev.com/c7c76532cc8698c31c622c3340fd0b33ec0d36e3/ui/events/keycodes/keyboard_code_conversion_android.cc

Comment 7 by chongz@chromium.org, Nov 10 2016

Cc: chongz@chromium.org
Labels: M-56
Status: Fixed (was: Started)

Sign in to add a comment