-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
3.0.0-beta.5: AutocompleteInput and allowEmpty issue #3920
Comments
Thank you for opening this issue. In order to confirm it, we'll have to reproduce it. https://codesandbox.io/s/github/marmelab/react-admin/tree/next/examples/simple This is the simplest way to confirm a bug is related to the React Admin codebase. |
https://codesandbox.io/s/simple-rzpk0?fontsize=14 |
Confirmed, thanks for reporting! |
Fixed by #3953 |
|
@fzaninotto this fix did not publish in beta.6?it seem did not on effect on beta.6 |
!yes it did, but you must set the |
What you were expecting:
AutocompleteInput shows suggestion for empty value to clear a current selection.
What happened instead:
The empty value suggestion item is shown if there is no matching value selected yet. Thats OK.
But:
If a matching value is selected, there is no empty suggestion item in list of suggestions.
So you can't change selection from previously selected value back to null (empty).
Steps to reproduce:
AutocompleteInput with allowEmpty set
Related code:
see useSuggestion hook: In getSuggestionsFactory the emptySuggestion is not added when limiting choices because of a currently selected item.
An emptySuggestion item will only be added to list of suggestions if no item has been selected yet.
This is why you cannot clear a current selection.
BTW: it would be more intuitive if the emptySelection would be inserted on top.
Currently the emptySelection item is appended and you have to scroll to reach it.
And: Clearing out the input field manually (backspace) and pressing Enter performs nothing although allowEmpty should cause a cleared input to select the matching emptySuggestion.
Environment
The text was updated successfully, but these errors were encountered: