fix: recognize function keys F1–F24 when assigning hotkeys (#2157)

keyboardCodeToHotkeyKey had branches for Key*, Digit*, and Numpad* codes
but none for function keys, so KeyboardEvent.code values "F1".."F24"
returned null and the hotkey capture handler silently dropped them. This
made every function key unassignable (not just F13+ such as F21/F22).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ryan Kupka
2026-06-17 01:54:39 -06:00
committed by GitHub
parent 10332fdeaf
commit c301b14cb3
@@ -61,6 +61,10 @@ export const keyboardCodeToHotkeyKey = (code: string): null | string => {
return code.slice(5); return code.slice(5);
} }
if (/^F([1-9]|1\d|2[0-4])$/.test(code)) {
return code.toLowerCase();
}
if (code.startsWith('Numpad')) { if (code.startsWith('Numpad')) {
const suffix = code.slice(6); const suffix = code.slice(6);
const numpadMapped = NUMPAD_CODE_TO_HOTKEY_KEY[suffix]; const numpadMapped = NUMPAD_CODE_TO_HOTKEY_KEY[suffix];