Skip to content

Commit e534dbd

Browse files
committed
[#45] ✨ Add e.preventDefault() and explicit Enter key handling
1 parent a9ca184 commit e534dbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/handleKeyDown.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ export const handleKeyDown = (
33
callback: () => void,
44
disabled?: boolean
55
): void => {
6-
if (e.key === 'Enter' && !disabled) {
6+
if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
7+
e.preventDefault()
78
callback()
89
}
910
}

0 commit comments

Comments
 (0)