You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KeyboardEvent.get() returns the key which would be typed if the current physical key were pressed with no modifiers.
On some layouts, numeric keys (0-9) type national or punctuation characters instead, and the digits must be accessed by holding Shift. For example, on AZERTY, [Digit3] types " (double quote). To type 3, you have to press Shift+[Digit3], or have CapsLock on.
I propose the following exception:
On layouts on which numeric keys (0-9) require Shift to type digits (examples: AZERTY, Czech QWERTZ, Lithuanian), .get() should always return the digit.
On such locales, shortcuts which use [Digit0] - [Digit9] are generally referred to using the digit, even if the digit is not the "base" (unmodified) key. I'm sure French or Czech users would find it strange to see shortcuts referred to as Ctrl+( (AZERTY 5), ' (AZERTY 4) or Alt++ (Czech 1).
Here are examples of Microsoft's Windows shortcut cheatsheets for French and Czech. Notice it says "Touche de logo Windows + numéro" and "Ctrl+1" (WordPad section).
PS. In my Web app, I have some commands bound to Alt+1, Alt+2, etc. and it would be easier if KeyboardMap.get() returned the digit in such cases, rather than the unmodified key. Right now the workaround is to compare KeyboardMap.get("Digit1") with "1" to detect such layouts and fall back to using KeyboardEvent.code. Can't just use .code all the time, because there are actually layouts where the digits on keycaps don't match KeyboardEvent.code.
The text was updated successfully, but these errors were encountered:
KeyboardEvent.get()
returns the key which would be typed if the current physical key were pressed with no modifiers.On some layouts, numeric keys (0-9) type national or punctuation characters instead, and the digits must be accessed by holding Shift. For example, on AZERTY, [Digit3] types " (double quote). To type 3, you have to press Shift+[Digit3], or have CapsLock on.
I propose the following exception:
On such locales, shortcuts which use [Digit0] - [Digit9] are generally referred to using the digit, even if the digit is not the "base" (unmodified) key. I'm sure French or Czech users would find it strange to see shortcuts referred to as
Ctrl+(
(AZERTY 5),'
(AZERTY 4) orAlt++
(Czech 1).Here are examples of Microsoft's Windows shortcut cheatsheets for French and Czech. Notice it says "Touche de logo Windows + numéro" and "Ctrl+1" (WordPad section).
https://support.microsoft.com/fr-fr/help/12445/windows-keyboard-shortcuts
https://support.microsoft.com/cs-cz/help/12445/windows-keyboard-shortcuts
PS. In my Web app, I have some commands bound to Alt+1, Alt+2, etc. and it would be easier if
KeyboardMap.get()
returned the digit in such cases, rather than the unmodified key. Right now the workaround is to compare KeyboardMap.get("Digit1") with "1" to detect such layouts and fall back to usingKeyboardEvent.code
. Can't just use.code
all the time, because there are actually layouts where the digits on keycaps don't matchKeyboardEvent.code
.The text was updated successfully, but these errors were encountered: