From d01c4ce4facb5746e1fd39cd91314982acbc0a97 Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 16 Nov 2025 03:55:44 +0000 Subject: [PATCH 1/3] Auto focus the first item within Combobox when the filtered items change --- packages/@react-aria/combobox/src/useComboBox.ts | 1 + packages/@react-stately/combobox/src/useComboBoxState.ts | 3 ++- packages/react-aria-components/src/ComboBox.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@react-aria/combobox/src/useComboBox.ts b/packages/@react-aria/combobox/src/useComboBox.ts index 5fe460012f0..cead9d21920 100644 --- a/packages/@react-aria/combobox/src/useComboBox.ts +++ b/packages/@react-aria/combobox/src/useComboBox.ts @@ -117,6 +117,7 @@ export function useComboBox(props: AriaComboBoxOptions, state: ComboBoxSta keyboardDelegate: delegate, disallowTypeAhead: true, disallowEmptySelection: true, + autoFocus: 'first', shouldFocusWrap, ref: inputRef, // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index e2cce7de048..1ad8c38c864 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -236,7 +236,8 @@ export function useComboBoxState(props: ComboBoxStateOptions({props, collection, comboBoxRef: ref}: style: {'--trigger-width': menuWidth} as React.CSSProperties, clearContexts: CLEAR_CONTEXTS }], - [ListBoxContext, {...listBoxProps, ref: listBoxRef}], + [ListBoxContext, {...listBoxProps, autoFocus: 'first', ref: listBoxRef}], [ListStateContext, state], [TextContext, { slots: { From d742b49872e755ede313a46640f36dceafd00947 Mon Sep 17 00:00:00 2001 From: Will Date: Sat, 15 Nov 2025 22:14:56 -0600 Subject: [PATCH 2/3] Fix formatting of if statement in useComboBoxState Fix lint issue --- packages/@react-stately/combobox/src/useComboBoxState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index 1ad8c38c864..8f776a3665f 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -237,7 +237,7 @@ export function useComboBoxState(props: ComboBoxStateOptions Date: Sat, 15 Nov 2025 22:35:09 -0600 Subject: [PATCH 3/3] Format code for clarity in useComboBoxState.ts --- packages/@react-stately/combobox/src/useComboBoxState.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index 8f776a3665f..ad1ec15027d 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -237,7 +237,9 @@ export function useComboBoxState(props: ComboBoxStateOptions