Re: [w3c/uievents] "keyCode" is the only way to work with KeyboardEvents now (#267)

To summarize: the "t" key on a dvorak layout is where the "k" key is on a standard QWERTY layout, so the `code` value will always be `KeyK` for this.

On a Dvorak layout, the following `key` values are produced:
* KeyK -> t
* Shift + KeyK -> T
* Alt + KeyK -> † (dagger)
* Shift + Alt + KeyK -> ˇ (caron/hacek)

Ctrl + any of the above combos returns the same character for `key`. The only common value is `code` = `KeyK`.

The deprecated `keyCode` field was not specified properly and is implemented inconsistently across browsers (even across the same browser for different OSs). If you try this key combo on other browsers/OSs, it can return different values.

In this case, the name of the key is `code` = `KeyK` and you can rely on this being true for all browsers/OSs (unless there are bugs, which will be fixed). This design is to support the common use case so that (for example) the WASD keys in games can work for Dvorak users (or any locale) by default.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/267#issuecomment-652100912

Received on Tuesday, 30 June 2020 23:31:31 UTC