File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,14 @@ const SearchBar = ({
113
113
}
114
114
}
115
115
116
+ const inputCallbackRef : React . RefCallback < HTMLInputElement > = ( node = null ) => {
117
+ if ( inputProps . ref ) {
118
+ // eslint-disable-next-line no-param-reassign
119
+ inputProps . ref . current = node
120
+ }
121
+ inputRef . current = node
122
+ }
123
+
116
124
return (
117
125
< div className = { containerClassName } >
118
126
< div
@@ -130,7 +138,7 @@ const SearchBar = ({
130
138
} ${ noBackgroundAndBorder ? 'dc__no-background' : 'bc-n50' } `}
131
139
onChange = { handleChange }
132
140
onKeyDown = { handleKeyDown }
133
- ref = { inputRef }
141
+ ref = { inputCallbackRef }
134
142
/>
135
143
{ /* TODO: Sync with product since it should have ic-enter in case of not applied */ }
136
144
{ showClearButton && (
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ export interface SearchBarProps {
32
32
/**
33
33
* Input props for the search input
34
34
*/
35
- inputProps ?: React . InputHTMLAttributes < HTMLInputElement >
35
+ inputProps ?: React . InputHTMLAttributes < HTMLInputElement > &
36
+ Partial < Record < 'ref' , React . MutableRefObject < HTMLInputElement > > >
36
37
/**
37
38
* Class name for the container; can be used for handling width
38
39
*/
You can’t perform that action at this time.
0 commit comments