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

Revert "Add requireExactMatch prop to ComboBox to prevent wrong country/state values being sent to the server" #6447

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions assets/js/base/components/combobox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export interface ComboboxProps {
options: ComboboxControlOption[];
required?: boolean;
value: string;
requireExactMatch?: boolean;
}

/**
Expand All @@ -55,7 +54,6 @@ const Combobox = ( {
errorId: incomingErrorId,
instanceId = '0',
autoComplete = 'off',
requireExactMatch = false,
}: ComboboxProps ): JSX.Element => {
const {
getValidationError,
Expand Down Expand Up @@ -138,13 +136,7 @@ const Combobox = ( {
normalizedFilterValue
);
if ( foundOption ) {
if ( ! requireExactMatch ) {
onChange( foundOption.value );
return;
}
if ( foundOption.label === filterValue ) {
onChange( foundOption.value );
}
onChange( foundOption.value );
}
}
} }
Expand Down
56 changes: 0 additions & 56 deletions assets/js/base/components/combobox/test/index.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/base/components/country-input/country-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const CountryInput = ( {
errorMessage={ errorMessage }
required={ required }
autoComplete={ autoComplete }
requireExactMatch={ true }
/>
{ autoComplete !== 'off' && (
<input
Expand Down
1 change: 0 additions & 1 deletion assets/js/base/components/state-input/state-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ const StateInput = ( {
) }
required={ required }
autoComplete={ autoComplete }
requireExactMatch={ true }
/>
{ autoComplete !== 'off' && (
<input
Expand Down