From b0dfdeba6074e655b02a96d51dc40cafe2a61edf Mon Sep 17 00:00:00 2001 From: mmelko Date: Wed, 18 Mar 2026 10:43:39 +0100 Subject: [PATCH] fix(Suggestions): Focus search input when opening suggestions menu --- src/form/hooks/suggestions.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/form/hooks/suggestions.tsx b/src/form/hooks/suggestions.tsx index b441539..ca10a1a 100644 --- a/src/form/hooks/suggestions.tsx +++ b/src/form/hooks/suggestions.tsx @@ -61,8 +61,7 @@ export const useSuggestions = ({ setSearchValue(''); setCurrentOpenMenu(menuId); requestAnimationFrame(() => { - firstElementRef.current?.focus(); - firstElementRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' }); + searchInputRef.current?.focus(); }); } else if (event.key === 'Escape') { onEscapeKey(event); @@ -160,8 +159,7 @@ export const useSuggestions = ({ const newValue = prev === menuId ? null : menuId; if (newValue) { requestAnimationFrame(() => { - firstElementRef.current?.focus(); - firstElementRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' }); + searchInputRef.current?.focus(); }); } return newValue;