Re: [w3c/uievents] Need virtual key codes (Issue #377)

@masayuki-nakano 
> web apps handle .keyCode values with checking UA etc

Actually, `.keyCode` behaves consistently across browsers for alphanumeric and functional keys, it's only punctuation/symbol keys that differ wildly, according to this comprehensive table of `keyCode` values across browsers (see section 3.3. Key Code Values): https://unixpapa.com/js/key.html

That's why in my "Recommended Workaround" section I recommended that shortcuts that use `Alt` should only be used with alphanumeric and functional keys. In retrospect, that's true of `Shift` as well.

> In my experience at implementing the shortcut key handling rules of Firefox, completely compatible behavior between browsers and/or platforms may be impossible. Especially when `Shift` key is required, there are some open bugs in Firefox with some keyboard layouts which map punctuation to numeric keys. E.g., `Ctrl + Shift + 1` may be conflict with `Ctrl + !` if `!` is mapped to `Digit1` key.

I don't understand this paragraph. On a US QWERTY keyboard, `Ctrl + Shift + 1` and `Ctrl + !` are inherently conflicting. That doesn't seem like a Firefox bug? That seems like that would be true in every browser and on every platform, and wouldn't be an obstacle to cross-browser compatibility at all?

> This is also fixable with the above approach.

What approach?

> it might be better to make new API work only when the key combination matches only with `[a-z0-9 ]`

If you accept this constraint, `.keyCode` is actually already does what you want, as noted above.

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

Message ID: <w3c/uievents/issues/377/2400884320@github.com>

Received on Tuesday, 8 October 2024 21:51:11 UTC