Skip to content

Commit abb469a

Browse files
committed
chore: merge return condition into one
1 parent 068c13d commit abb469a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Common/Hooks/UseRegisterShortcut/UseRegisterShortcutProvider.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ const UseRegisterShortcutProvider = ({
121121
}
122122

123123
if (
124+
// NOTE: in case of custom events generated by password managers autofill, the event.key is not set
125+
!event.key ||
124126
ignoredTags.map((tag) => tag.toUpperCase()).indexOf((event.target as HTMLElement).tagName?.toUpperCase()) >
125127
-1 ||
126128
(event.target as HTMLElement)?.role === 'textbox' ||
@@ -129,12 +131,7 @@ const UseRegisterShortcutProvider = ({
129131
return
130132
}
131133

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>)
134+
keysDownRef.current.add(event.key.toUpperCase() as Uppercase<string>)
138135

139136
if (event.ctrlKey) {
140137
keysDownRef.current.add('CONTROL')

0 commit comments

Comments
 (0)