Keyboard map API not returning key sym for Japanese keyboard |
|||||
Issue description
Chrome Version: 69.0.3497.100 (Official Build) (64 bit)
OS: (e.g. Win10, MacOS 10.12, etc...) Windows
What steps will reproduce the problem?
(1) Plug in a Japanese keyboard, change Windows keyboard layout
(2) Run the script:
navigator.keyboard.getLayoutMap().then(function(map) { console.log(map.size); for(k of map.entries()) { console.log(k); }; })
(3)
What is the expected result?
Expect "Quote" to map to ":"
What happens instead?
"Quote" maps to "'"
Output of script:
Promise {<pending>}
VM174:1 48
VM174:1 (2) ["KeyE", "e"]
VM174:1 (2) ["KeyD", "d"]
VM174:1 (2) ["Minus", "-"]
VM174:1 (2) ["KeyH", "h"]
VM174:1 (2) ["KeyZ", "z"]
VM174:1 (2) ["Equal", "="]
VM174:1 (2) ["KeyN", "n"]
VM174:1 (2) ["KeyP", "p"]
VM174:1 (2) ["BracketRight", "]"]
VM174:1 (2) ["BracketLeft", "["]
VM174:1 (2) ["Digit8", "8"]
VM174:1 (2) ["Digit9", "9"]
VM174:1 (2) ["KeyS", "s"]
VM174:1 (2) ["Semicolon", ";"]
VM174:1 (2) ["Digit5", "5"]
VM174:1 (2) ["KeyQ", "q"]
VM174:1 (2) ["KeyO", "o"]
VM174:1 (2) ["Period", "."]
VM174:1 (2) ["Digit6", "6"]
VM174:1 (2) ["KeyV", "v"]
VM174:1 (2) ["Digit3", "3"]
VM174:1 (2) ["KeyL", "l"]
VM174:1 (2) ["Backquote", "`"]
VM174:1 (2) ["KeyG", "g"]
VM174:1 (2) ["KeyJ", "j"]
VM174:1 (2) ["KeyT", "t"]
VM174:1 (2) ["Quote", "'"]
VM174:1 (2) ["KeyY", "y"]
VM174:1 (2) ["IntlBackslash", "\"]
VM174:1 (2) ["KeyR", "r"]
VM174:1 (2) ["Backslash", "\"]
VM174:1 (2) ["KeyU", "u"]
VM174:1 (2) ["KeyK", "k"]
VM174:1 (2) ["Slash", "/"]
VM174:1 (2) ["KeyF", "f"]
VM174:1 (2) ["KeyI", "i"]
VM174:1 (2) ["KeyX", "x"]
VM174:1 (2) ["KeyA", "a"]
VM174:1 (2) ["Digit2", "2"]
VM174:1 (2) ["Digit7", "7"]
VM174:1 (2) ["KeyM", "m"]
VM174:1 (2) ["Digit4", "4"]
VM174:1 (2) ["KeyW", "w"]
VM174:1 (2) ["Digit1", "1"]
VM174:1 (2) ["Digit0", "0"]
VM174:1 (2) ["KeyB", "b"]
VM174:1 (2) ["KeyC", "c"]
VM174:1 (2) ["Comma", ","]
Please use labels and text to provide additional information.
If this is a regression (i.e., worked before), please consider using the
bisect tool (https://www.chromium.org/developers/bisect-builds-py) to help
us identify the root cause and more rapidly triage the issue.
For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.
,
Oct 11
,
Oct 31
Tracking bug b/116829601 Ping. Any update on this?
,
Nov 12
,
Nov 16
A few things going on here: (1) Windows 10 handles the order of the languages in a strange way. You can set the order via the "Language Preferences" option in the Input Method pop-up menu and this usually matches the order returned by the GetKeyboardLayoutList API. But you can also adjust the visual order using the older "Control Panel > Language" and this will override the order shown to the user, but not the API. The order of this list (UI and API) ignores the currently active input language, so we manually re-order the list to move the active lang to the top. This is why it's confusing to use the UI to figure out which layout will be used (beyond the currently active one, which we force to the top). (2) The Japanese layout is technically not ASCII-capable because not all of the standard keys produce printable values. The Backquote key is normally a printable key, but the Japanese layout uses it for IME functions (half-width/full-width/kanji). Because of this, it fails the test to ensure that all keys return a printable value. AFAIK, Japanese is the only language that does this. To fix this to allow the Japanese layout to be considered ASCII-capable, we'd have to special case this key and return a special value.
,
Nov 16
,
Nov 17
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7 commit 9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7 Author: Gary Kacmarcik <garykac@chromium.org> Date: Sat Nov 17 00:20:46 2018 KeyboardMap - Fix Japanese layout Previously, the Japanese layout was not returned as the highest-prio ASCII-capable layout because not all of the writing-system-keys produced printable characters. Specifically, the Backquote key is used as the hankaku/zenkaku key to switch between half-width and full-width chars. This cl fixes that by handling the Japanese/Backquote key as a special case, and the keyboard map returns a descriptive string. Bug: 891501 Change-Id: Ic473700866d711a532d3946be73ff5ec38db580a Reviewed-on: https://chromium-review.googlesource.com/c/1340970 Commit-Queue: Gary Kacmarcik <garykac@chromium.org> Reviewed-by: Joe Downing <joedow@chromium.org> Cr-Commit-Position: refs/heads/master@{#609042} [modify] https://crrev.com/9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7/ui/events/keycodes/dom/dom_keyboard_layout.cc [modify] https://crrev.com/9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7/ui/events/keycodes/dom/dom_keyboard_layout.h [modify] https://crrev.com/9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7/ui/events/keycodes/dom/dom_keyboard_layout_map_base.cc [modify] https://crrev.com/9987bfb728f2d9d3c2a2b5621c9df202bd3f77c7/ui/events/keycodes/dom/dom_keyboard_layout_map_win.cc
,
Nov 30
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by slumpwuffle@google.com
, Oct 9