Skip to content

Commit

Permalink
fix(ListView): disable enter handler on empty cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Feb 1, 2024
1 parent 284e937 commit 7395576
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ListView/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ export const ListView: React.FC<ListViewProps> = ({ children, onKeyboardClick })

useEffect(() => {
if (cursor !== undefined && (spacePress || enterPress)) {
onKeyboardClick?.(items.current.get(cursor));
if (items.current.has(cursor)) {
onKeyboardClick?.(items.current.get(cursor));
}
}
}, [cursor, spacePress, enterPress, items, onKeyboardClick]);

Expand Down

0 comments on commit 7395576

Please sign in to comment.