react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

<AutocompleteInput> freeSolo without clearOnBlur issue

Open smeng9 opened this issue 2 years ago • 2 comments

What you were expecting:

In https://mui.com/material-ui/react-autocomplete/ AutocompleteInput have both comboBox mode and freeSolo mode

For freeSolo mode user should be able to type in the input box without the need to click add ... from the suggestion list. E.g. https://mui.com/material-ui/react-autocomplete/#search-input

What happened instead:

  1. The freeSolo mode prop seems is replaced by create or onCreate prop
  2. After disabling the clearOnBlur prop, the form save button cannot be clicked even the form's value have changed.

Steps to reproduce:

  1. Goto https://osy236.sse.codesandbox.io/#/comments/1
  2. In the last AutocompleteInput box type something other than "comment1" in suggestion list, e.g. "comment2"
  3. Click away from this input, so the inputbox should now have "comment2"
  4. The form's save button is not enabled.

Related code:

https://codesandbox.io/s/youthful-diffie-osy236?file=/src/comments/CommentEdit.tsx:4445-4481

Other information:

The suggested behavior would be if freeSolo is true and onCreate is undefined, The user does not need to click the create button in the suggestion list in order to create. They should be able to type something and leave it there.

Environment

  • React-admin version: 4.0.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 17.0.2
  • Browser: Firefox 99
  • Stack trace (in case of a JS error):

smeng9 avatar Apr 21 '22 19:04 smeng9

Hi, Thank you for submitting this. This does not really seems like a bug to me but rather a feature request. If I'm understanding this correctly the point is to save one click from the user right? I may be missing the point here, so feel free to argue if you disagree 😅

slax57 avatar Apr 25 '22 09:04 slax57

Yes, save-as-you-type. No need further user action to create an entry from popup dialog.

smeng9 avatar Apr 26 '22 19:04 smeng9