From d8b98c2db6f5b22654482df0b35701afddde4a84 Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Fri, 19 Jan 2024 10:29:01 +0100 Subject: [PATCH 1/2] Fix default value for mapKey This addresses an issue where IE11 (groan) at times does not set a key to map --- src/parseHotkeys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parseHotkeys.ts b/src/parseHotkeys.ts index cfc6ddb6..ab406bce 100644 --- a/src/parseHotkeys.ts +++ b/src/parseHotkeys.ts @@ -25,7 +25,7 @@ const mappedKeys: Record = { } export function mapKey(key: string): string { - return (mappedKeys[key] || key) + return (mappedKeys[key] || key || '') .trim() .toLowerCase() .replace(/key|digit|numpad|arrow/, '') From 4290ad364bd5ac733652be95815e60c05e4fcdef Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Sun, 10 Mar 2024 11:19:59 +0100 Subject: [PATCH 2/2] docs: update the accepted type for `key` --- src/parseHotkeys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parseHotkeys.ts b/src/parseHotkeys.ts index ab406bce..f1ef21d3 100644 --- a/src/parseHotkeys.ts +++ b/src/parseHotkeys.ts @@ -24,7 +24,7 @@ const mappedKeys: Record = { ControlRight: 'ctrl', } -export function mapKey(key: string): string { +export function mapKey(key?: string): string { return (mappedKeys[key] || key || '') .trim() .toLowerCase()