marmelab / react-admin

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
24.96k stars 5.25k forks source link

Improper input value selection process for Autocomplete/ReferenceInput combo #8096

Closed ZachSelindh closed 2 years ago

ZachSelindh commented 2 years ago

What you were expecting: Consistent behavior from AutocompleteInputs as children of ReferenceInputs.

What happened instead: The AutocompleteInput will save incomplete text inputs without having made a dropdown selection.

The ReferenceInput does not seem to be making the appropriate calls when given the prop "enableGetChoices"

Steps to reproduce: Add an AutocompleteInput with common props such as filterToQuery and shouldRenderSuggestions as a child of a ReferenceInput with common props such as enableGetChoices.

Related code: https://codesandbox.io/s/ecstatic-ptolemy-64jbky?file=/src/posts/PostCreate.tsx

Environment

WiXSL commented 2 years ago

I don't understand your issue. Could you be more schematic about how to reproduce the issue, and what is the intended behavior? Thanks.

ZachSelindh commented 2 years ago

@WiXSL Absolutely. Essentially, a ReferenceInput/AutocompleteInput used to require to user to select one of the matching choices in the dropdown list. Now, the entered text persists whether a choice has been made or not, which is confusing and will lead to users believing they have made a choice when they have not.

WiXSL commented 2 years ago

It seems like a bug. I'm marking it as such. Let me see what I can find since by default, the AutocompleteInput has the MUI's clearOnBlur prop set to true, but it doesn't seem to be working