diff --git a/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.spec.tsx b/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.spec.tsx index 916d7495cf1..4ecbe6a7a80 100644 --- a/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.spec.tsx +++ b/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.spec.tsx @@ -103,11 +103,14 @@ describe('DetailsEanSearch', () => { subcategoryId: 'SUPPORT_PHYSIQUE_MUSIQUE_VINYLE', }) - expect(screen.getByText(subCatErrorMessage)).toBeInTheDocument() - const eanInput = screen.getByRole('textbox', { name: inputLabel }) - await userEvent.type(eanInput, '9781234567897') + // Input is now required. + expect(eanInput).toBeRequired() + + // Error cannot be removed by typing in the input. + expect(screen.getByText(subCatErrorMessage)).toBeInTheDocument() + await userEvent.type(eanInput, '9781234567897') expect(screen.getByText(subCatErrorMessage)).toBeInTheDocument() }) diff --git a/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.tsx b/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.tsx index 56db579b556..9328b2fceca 100644 --- a/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.tsx +++ b/pro/src/screens/IndividualOffer/DetailsScreen/DetailsEanSearch/DetailsEanSearch.tsx @@ -148,6 +148,7 @@ export const DetailsEanSearch = ({ } const shouldInputBeDisabled = isProductBased || isFetchingProduct + const shouldInputBeRequired = !!subcatError const shouldButtonBeDisabled = isProductBased || !ean || !!formikError || !!apiError || isFetchingProduct const displayClearButton = isNotAnOfferYetButProductBased @@ -167,7 +168,10 @@ export const DetailsEanSearch = ({ > Nouveau - Scanner ou rechercher un produit par EAN + + Scanner ou rechercher un produit par EAN + {shouldInputBeRequired && ' *'} + ) @@ -187,7 +191,8 @@ export const DetailsEanSearch = ({ type="text" disabled={shouldInputBeDisabled} maxLength={13} - isOptional + isOptional={!shouldInputBeRequired} + showMandatoryAsterisk={false} countCharacters {...(externalError && { externalError,