-
+
diff --git a/plugins/woocommerce-admin/packages/components/src/select-control/control.js b/plugins/woocommerce-admin/packages/components/src/select-control/control.js
index 7777db2413b..a0d61d0df9e 100644
--- a/plugins/woocommerce-admin/packages/components/src/select-control/control.js
+++ b/plugins/woocommerce-admin/packages/components/src/select-control/control.js
@@ -110,6 +110,7 @@ class Control extends Component {
return (
{
@@ -226,9 +228,26 @@ export class SelectControl extends Component {
) );
}
+ onAutofillChange( event ) {
+ const { options } = this.props;
+ const filteredOptions = this.getFilteredOptions( options, event.target.value );
+
+ if ( 1 === filteredOptions.length ) {
+ this.selectOption( filteredOptions[ 0 ] );
+ }
+ }
+
render() {
- const { className, inlineTags, instanceId, isSearchable, options } = this.props;
- const { isExpanded, selectedIndex } = this.state;
+ const {
+ autofill,
+ children,
+ className,
+ inlineTags,
+ instanceId,
+ isSearchable,
+ options,
+ } = this.props;
+ const { isExpanded, isFocused, selectedIndex } = this.state;
const hasTags = this.hasTags();
const { key: selectedKey = '' } = options[ selectedIndex ] || {};
@@ -241,10 +260,21 @@ export class SelectControl extends Component {
+ { autofill && (
+
+ ) }
+ { children }