diff options
| author | Stephen Blott | 2016-06-02 06:18:36 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-06-02 06:18:36 +0100 |
| commit | 2789c16e25416a6763c075a1b7718973a83403ef (patch) | |
| tree | 81e2813f5c21c3d5c760e041302487aa7895fa27 /lib/keyboard_utils.coffee | |
| parent | ae7c6f98f47868f5aecdaad5bd33aaa91f2550fd (diff) | |
| download | vimium-2789c16e25416a6763c075a1b7718973a83403ef.tar.bz2 | |
Favour event.keyIdentifier over event.key.
See #2147.
Chromium's implementation of event.key currently fails to take account
of keyboard mappings (e.g. neo2).
Here, we favour using event.keyIdentifier (while it's available) as a
workaround.
Diffstat (limited to 'lib/keyboard_utils.coffee')
| -rw-r--r-- | lib/keyboard_utils.coffee | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee index 364ab949..f997b455 100644 --- a/lib/keyboard_utils.coffee +++ b/lib/keyboard_utils.coffee @@ -33,10 +33,12 @@ KeyboardUtils = # We are migrating from using event.keyIdentifier to using event.key. For some period of time, we must # support both. This wrapper can be removed once Chrome 52 is considered too old to support. getKeyChar: (event) -> - if event.key? - @getKeyCharUsingKey event - else + # We favor using event.keyIdentifier due to Chromium's currently (Chrome 51) incorrect implementataion of + # event.key; see #2147. + if event.keyIdentifier? @getKeyCharUsingKeyIdentifier event + else + @getKeyCharUsingKey event getKeyCharUsingKey: (event) -> if event.keyCode of @keyNames |
