From 64e4a40170920a3edc7817af0ef203b73a7caf6e Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Tue, 20 Aug 2024 13:40:51 -0700 Subject: [PATCH] Fix combobox focus from being lost when filtering large collections (#6913) --- packages/@react-aria/selection/src/useSelectableCollection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-aria/selection/src/useSelectableCollection.ts b/packages/@react-aria/selection/src/useSelectableCollection.ts index 912ffc04099..4b2cea96c0b 100644 --- a/packages/@react-aria/selection/src/useSelectableCollection.ts +++ b/packages/@react-aria/selection/src/useSelectableCollection.ts @@ -424,7 +424,7 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions } // If the focused key becomes null (e.g. the last item is deleted), focus the whole collection. - if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) { + if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) { focusSafely(ref.current); }