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

Enhancement: allowEmpty - position of empty item #3935

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

Enhancement: allowEmpty - position of empty item #3935

MiMo42 opened this issue Nov 5, 2019 · 2 comments

Comments

@MiMo42
Copy link
Contributor

MiMo42 commented Nov 5, 2019

What you were expecting:
SelectInput and AutocompleteInput should both render empty item at top of list.

What happened instead:
SelectInput renders empty item at top, AutocompleteInput renders empty item an end of list of suggestions (needs us to scroll).

Other information:
From a UI/UX perspective it should be consistent.

Environment

  • React-admin version: 16.10
  • React version: 3.0.0-beta.5
  • Browser: Chrome
@MiMo42
Copy link
Contributor Author

MiMo42 commented Nov 6, 2019

After some time working on this, I decided to omit allowEmpty and emptyText support as a whole.
I came up with the idea, that autocomplete should always allowEmpty (delete text and press reset icon button). Its more user centric and more like other AC inputs out there.
I think the user should always be able to clear and restart to search for matches.
We have form validation to force the user to finally fill out the AutocompleteInput component if necessary.
Unfortunately its a BC break, so no pull request into the official next branch in sight.
For now, i will add the components as custom components to my project.

https://github.com/MiMo42/react-admin/tree/AutocompleteFixes
I modified:

  • AutocompleteInput.tsx
  • AutocompleteInput.spec.tsx,
  • useSuggestions.ts,
  • useSuggestions.spec.ts,
  • AutocompleteArrayInput.tsx

Perhaps it is a starting point for others.

@MiMo42 MiMo42 closed this as completed Nov 6, 2019
@fzaninotto
Copy link
Member

Should be fixed by #3953

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

2 participants