Skip to content

Commit 2f76b0b

Browse files
Fatimahzzacharo
authored andcommitted
ui: adds focus prop to dropdown select
1 parent 96b833b commit 2f76b0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/forms/RemoteSelectField.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export class RemoteSelectField extends Component {
179179
preSearchChange,
180180
onValueChange,
181181
search,
182+
isFocused,
182183
...uiProps
183184
} = this.props;
184185
const compProps = {
@@ -197,6 +198,7 @@ export class RemoteSelectField extends Component {
197198
preSearchChange,
198199
onValueChange,
199200
search,
201+
isFocused,
200202
};
201203
return { compProps, uiProps };
202204
};
@@ -214,6 +216,7 @@ export class RemoteSelectField extends Component {
214216
search={compProps.search}
215217
searchInput={{
216218
id: compProps.fieldPath,
219+
autoFocus: compProps.isFocused,
217220
}}
218221
lazyLoad
219222
open={open}
@@ -270,6 +273,7 @@ RemoteSelectField.propTypes = {
270273
onValueChange: PropTypes.func, // Takes the SUI hanf and updated selectedSuggestions
271274
search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
272275
multiple: PropTypes.bool,
276+
isFocused: PropTypes.bool,
273277
};
274278

275279
RemoteSelectField.defaultProps = {
@@ -287,4 +291,5 @@ RemoteSelectField.defaultProps = {
287291
serializeAddedValue: undefined,
288292
initialSuggestions: [],
289293
onValueChange: undefined,
294+
isFocused: false,
290295
};

0 commit comments

Comments
 (0)