Skip to content

Commit

Permalink
fix(ShortcutManager/normalizeKeyCode): code param can be undefined (#…
Browse files Browse the repository at this point in the history
…3097)

The `code` param for `normalizeKeyCode` can sometimes be `undefined`,
e.g. when using browser input autocomplete functionalities.

Closes #2838

Signed-off-by: schogges <[email protected]>
  • Loading branch information
schogges authored Oct 25, 2024
1 parent 04713ab commit e836d92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/common/filter-bar/ShortcutManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ function triggerShortcuts<CommandKeyword extends string>(event: KeyboardEvent, k
command.trigger(event)
}

function normalizeKeyCode(code: string): string {
/**
* `code` can sometimes be undefined, e.g. when using input field autocomplete functionalities.
* @param {string|undefined} code - Default: empty string `''`
*/
function normalizeKeyCode(code: string | undefined = ''): string {
// Returns relevant modifier keys as the empty string which is going to be filtered out.
if (MODIFIER_KEY_CODES.includes(code)) {
return ''
Expand Down

0 comments on commit e836d92

Please sign in to comment.