diff --git a/packages/vkui/src/components/CustomSelect/CustomSelect.tsx b/packages/vkui/src/components/CustomSelect/CustomSelect.tsx index a64d33480f..b7cd75709c 100644 --- a/packages/vkui/src/components/CustomSelect/CustomSelect.tsx +++ b/packages/vkui/src/components/CustomSelect/CustomSelect.tsx @@ -219,6 +219,7 @@ export function CustomSelect(null); const selectElRef = useExternRef(getRef); const optionsWrapperRef = React.useRef(null); + const selectInputRef = useExternRef(getSelectInputRef); const [focusedOptionIndex, setFocusedOptionIndex] = React.useState(-1); const [isControlledOutside, setIsControlledOutside] = React.useState(props.value !== undefined); @@ -421,7 +422,8 @@ export function CustomSelect { const event = new Event('focusin', { bubbles: true }); selectElRef.current?.dispatchEvent(event); - }, [selectElRef]); + selectInputRef.current?.select(); + }, [selectElRef, selectInputRef]); const onClick = React.useCallback(() => { if (opened) { @@ -668,7 +670,6 @@ export function CustomSelect>(); const focusOnInput = React.useCallback(() => { clearTimeout(focusOnInputTimerRef.current); @@ -770,7 +771,9 @@ export function CustomSelect