From 20aabf902efae358082a6f9fda1ae2b3bfbb67ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guzm=C3=A1n?= Date: Wed, 10 Sep 2025 17:54:07 +0200 Subject: [PATCH 1/2] Add autoFocusOption prop --- packages/react-select/src/Select.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/react-select/src/Select.tsx b/packages/react-select/src/Select.tsx index 146d084e20..596a344f96 100644 --- a/packages/react-select/src/Select.tsx +++ b/packages/react-select/src/Select.tsx @@ -92,6 +92,8 @@ export interface Props< ariaLiveMessages?: AriaLiveMessages; /** Focus the control when it is mounted */ autoFocus?: boolean; + /** Focus an option when no inputValue is given */ + autoFocusOption?: boolean; /** Remove the currently focused option when the user presses backspace when Select isClearable or isMulti */ backspaceRemovesValue: boolean; /** Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) */ @@ -281,6 +283,7 @@ export interface Props< export const defaultProps = { 'aria-live': 'polite', + autoFocusOption: true, backspaceRemovesValue: true, blurInputOnSelect: isTouchCapable(), captureMenuScroll: !isTouchCapable(), @@ -529,11 +532,17 @@ function getNextFocusedOption< Option, IsMulti extends boolean, Group extends GroupBase