Numpad keys will now be recognised by the keybinds menu (#63128)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
GoldenAlpharex
2021-11-30 20:54:40 -08:00
committed by GitHub
co-authored by Mothblocks Aleksej Komarov
parent 7ce26590ba
commit 652f2c591e
@@ -49,6 +49,13 @@ const KEY_CODE_TO_BYOND: Record<string, string> = {
"UP": "North",
};
/**
* So, as it turns out, KeyboardEvent seems to be broken with IE 11, the
* DOM_KEY_LOCATION_X codes are all undefined. See this to see why it's 3:
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location
*/
const DOM_KEY_LOCATION_NUMPAD = 3;
const sortKeybindings = sortBy(
([_, keybinding]: [string, Keybinding]) => {
return keybinding.name;
@@ -74,7 +81,7 @@ const formatKeyboardEvent = (event: KeyboardEvent): string => {
text += "Shift";
}
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) {
if (event.location === DOM_KEY_LOCATION_NUMPAD) {
text += "Numpad";
}