From 7395576ac3f567308fd97fe7c029a8413cdcd00a Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 1 Feb 2024 22:06:54 +0300 Subject: [PATCH] fix(ListView): disable enter handler on empty cursor --- src/components/ListView/ListView.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ListView/ListView.tsx b/src/components/ListView/ListView.tsx index 8f1f4e77..3c7db1a3 100644 --- a/src/components/ListView/ListView.tsx +++ b/src/components/ListView/ListView.tsx @@ -171,7 +171,9 @@ export const ListView: React.FC = ({ 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]);