Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit a4e6854

Browse files
authored
Remove country and state autocomplete fields (#7953)
1 parent f98f221 commit a4e6854

File tree

2 files changed

+16
-67
lines changed

2 files changed

+16
-67
lines changed

assets/js/base/components/country-input/country-input.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,6 @@ export const CountryInput = ( {
5757
required={ required }
5858
autoComplete={ autoComplete }
5959
/>
60-
{ autoComplete !== 'off' && (
61-
<input
62-
type="text"
63-
aria-hidden={ true }
64-
autoComplete={ autoComplete }
65-
value={ value }
66-
onChange={ ( event ) => {
67-
const textValue =
68-
event.target.value.toLocaleUpperCase();
69-
const foundOption = options.find(
70-
( option ) =>
71-
( textValue.length !== 2 &&
72-
option.label.toLocaleUpperCase() ===
73-
textValue ) ||
74-
( textValue.length === 2 &&
75-
option.value.toLocaleUpperCase() ===
76-
textValue )
77-
);
78-
onChange( foundOption ? foundOption.value : '' );
79-
} }
80-
style={ {
81-
minHeight: '0',
82-
height: '0',
83-
border: '0',
84-
padding: '0',
85-
position: 'absolute',
86-
} }
87-
tabIndex={ -1 }
88-
/>
89-
) }
9060
</div>
9161
);
9262
};

assets/js/base/components/state-input/state-input.tsx

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -88,44 +88,23 @@ const StateInput = ( {
8888

8989
if ( options.length > 0 ) {
9090
return (
91-
<>
92-
<Combobox
93-
className={ classnames(
94-
className,
95-
'wc-block-components-state-input'
96-
) }
97-
id={ id }
98-
label={ label }
99-
onChange={ onChangeState }
100-
options={ options }
101-
value={ value }
102-
errorMessage={ __(
103-
'Please select a state.',
104-
'woo-gutenberg-products-block'
105-
) }
106-
required={ required }
107-
autoComplete={ autoComplete }
108-
/>
109-
{ autoComplete !== 'off' && (
110-
<input
111-
type="text"
112-
aria-hidden={ true }
113-
autoComplete={ autoComplete }
114-
value={ value }
115-
onChange={ ( event ) =>
116-
onChangeState( event.target.value )
117-
}
118-
style={ {
119-
minHeight: '0',
120-
height: '0',
121-
border: '0',
122-
padding: '0',
123-
position: 'absolute',
124-
} }
125-
tabIndex={ -1 }
126-
/>
91+
<Combobox
92+
className={ classnames(
93+
className,
94+
'wc-block-components-state-input'
12795
) }
128-
</>
96+
id={ id }
97+
label={ label }
98+
onChange={ onChangeState }
99+
options={ options }
100+
value={ value }
101+
errorMessage={ __(
102+
'Please select a state.',
103+
'woo-gutenberg-products-block'
104+
) }
105+
required={ required }
106+
autoComplete={ autoComplete }
107+
/>
129108
);
130109
}
131110

0 commit comments

Comments
 (0)