Skip to content

Commit 2405938

Browse files
committed
fix: key missing in case of custom keydown events
1 parent 402c559 commit 2405938

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Common/Hooks/UseRegisterShortcut/UseRegisterShortcutProvider.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,20 @@ const UseRegisterShortcutProvider = ({
121121
}
122122

123123
if (
124-
ignoredTags.map((tag) => tag.toUpperCase()).indexOf((event.target as HTMLElement).tagName.toUpperCase()) >
124+
ignoredTags.map((tag) => tag.toUpperCase()).indexOf((event.target as HTMLElement).tagName?.toUpperCase()) >
125125
-1 ||
126126
(event.target as HTMLElement)?.role === 'textbox' ||
127127
disableShortcutsRef.current
128128
) {
129129
return
130130
}
131131

132-
keysDownRef.current.add(event.key.toUpperCase() as Uppercase<string>)
132+
// NOTE: in case of custom events generated by password managers autofill, the event.key is not set
133+
if (!event.key) {
134+
return
135+
}
136+
137+
keysDownRef.current.add(event.key?.toUpperCase() as Uppercase<string>)
133138

134139
if (event.ctrlKey) {
135140
keysDownRef.current.add('CONTROL')

0 commit comments

Comments
 (0)