Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<AutocompleteInput>do not support to be empty #3933

Closed
anewcoder1992 opened this issue Nov 5, 2019 · 2 comments
Closed

<AutocompleteInput>do not support to be empty #3933

anewcoder1992 opened this issue Nov 5, 2019 · 2 comments

Comments

@anewcoder1992
Copy link

anewcoder1992 commented Nov 5, 2019

What you were expecting:
allow empty of the AutocompleteInput

What happened instead:
AutocompleteInput after select one value ,even you clear the input , always save the last selected choice .

Steps to reproduce:

  1. https://codesandbox.io/s/simple-ucjul
    2.enter to create comment page
    3.choose one item of posts,
    4.clear your input and leave
    5.you can see the input will load the value selected last time
    Related code:
    <ReferenceInput {...props} defaultValue={newPostId}>
                <AutocompleteInput optionText="title" allowEmpty />
            </ReferenceInput>

In document we can see following :

allowEmpty | Optional | boolean | false | If false and the searchText typed did not match any suggestion, the searchText will revert to the current value when the field is blurred. If true and the searchText is set to '' then the field will set the input value to null. |
but after selected one when the field is blurred. the input never became empty.
Environment

  • React-admin version: next
@MiMo42
Copy link
Contributor

MiMo42 commented Nov 5, 2019

Yes. see #3920
The empty item is missing as soon as a suggestion has been selected.

@Kmaschta
Copy link
Contributor

Kmaschta commented Nov 7, 2019

Closing as duplicated as #3920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants