I have a Chrome Extension that opens a popup window when a shortcut is pressed. The popup window has an keypress
event listener that looks at event.keyCode
.
I noticed that when I use Google Japanese IME on "Input Mode", the keyCodes I get are usually "incorrect". Instead of a = 97
, I get a = 65402
which is apparently a halfwidth katakana unicode character. This sometimes fixes itself by reopening the popup or clicking other things to shift the window focus around.
Can this prevented in any way? I might create a custom map for myself but the solution won't be perfect because when this issue occurs, I can press shift + a
and instead of getting an upper case A
, i.e. char code 65
, I still get 65402
.
"incorrect keycodes"
65409: 'a'
65402: 'b'
65407: 'c'
65404: 'd'
65394: 'e'
65418: 'f'
65399: 'g'
65400: 'h'
65414: 'i'
65423: 'j'
65417: 'k'
65432: 'l'
65427: 'm'
65424: 'n'
65431: 'o'
65406: 'p'
65408: 'q'
65405: 'r'
65412: 's'
65398: 't'
65413: 'u'
65419: 'v'
65411: 'w'
65403: 'x'
65437: 'y'
65410: 'z'
65415: '1'
65420: '2'
65393: '3'
65395: '4'
65396: '5'
65397: '6'
65428: '7'
65429: '8'
65430: '9'
65436: '0'