Skip to content

Commit ad74764

Browse files
committed
fix: auto focus issue for select picker
1 parent f9fc10c commit ad74764

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,9 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
284284
{...valueContainerProps}
285285
showSelectedOptionsCount={showSelectedOptionsCount}
286286
customSelectedOptionsCount={customSelectedOptionsCount}
287-
isFocussed={isFocussed}
288287
/>
289288
),
290-
[showSelectedOptionsCount, customSelectedOptionsCount, isFocussed],
289+
[showSelectedOptionsCount, customSelectedOptionsCount],
291290
)
292291

293292
const renderOption = useCallback(
@@ -469,6 +468,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
469468
onBlur={handleBlur}
470469
onChange={handleChange}
471470
controlShouldRenderValue={controlShouldRenderValue}
471+
isFocussed={isFocussed}
472472
/>
473473
</div>
474474
</ConditionalWrap>

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,12 @@ export const SelectPickerInput = <OptionValue,>(props: InputProps<SelectPickerOp
119119
export const SelectPickerValueContainer = <OptionValue, IsMulti extends boolean>({
120120
showSelectedOptionsCount,
121121
customSelectedOptionsCount,
122-
isFocussed,
123122
...props
124123
}: ValueContainerProps<SelectPickerOptionType<OptionValue>> &
125-
Pick<SelectPickerProps<OptionValue, IsMulti>, 'showSelectedOptionsCount' | 'customSelectedOptionsCount'> & {
126-
isFocussed: boolean
127-
}) => {
124+
Pick<SelectPickerProps<OptionValue, IsMulti>, 'showSelectedOptionsCount' | 'customSelectedOptionsCount'>) => {
128125
const {
129126
getValue,
130-
selectProps: { customDisplayText, shouldRenderTextArea },
127+
selectProps: { customDisplayText, shouldRenderTextArea, isFocussed },
131128
children,
132129
} = props
133130

src/Shared/Components/SelectPicker/type.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ declare module 'react-select/base' {
9898
* @default false
9999
*/
100100
shouldRenderTextArea?: boolean
101+
/**
102+
* Custom prop for the value container for focussed state
103+
*/
104+
isFocussed?: boolean
101105
}
102106
}
103107

0 commit comments

Comments
 (0)