-
-
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
Blur <Autocomplete /> after creating a new suggestion #6622
Comments
We can override this behaviour in userland by blurring the input component ourselves. You can see this in action in this codesandbox Here's a video of the desired behaviour remove-focus-suggestion.mov |
Thanks for the report! Would you mind applying your fix in a PR? |
Absolutely, would be more than happy to |
@djhi , I'm having trouble settling on where the logic should live. There are three options (that I've considered):
I'm inclined towards option 1 or 3. I'm not too keen on option 2 only because it feels like i'd be cluttering the AutocompleteInput component with logic pertaining to suggestions. Though I have no preference either way. I'd be happy to implement whichever solution you folks think is most appropriate |
Hi, I think this only concerns the However, simply blurring the input is not enough as if users focus it again, they'll still see the option to create a new item. So we need to show the create option only when it makes sense. However, as we also support a function which returns an element (the Finally, as we'll need to introduce a new prop for that, we'll have to target the |
This is observable in the codesandbox
Steps to reproduce:
Posts
inputcreate
buttonsave
buttonThe underlying behaviour associated the newly created record as the value for the
autocomplete
component. But there's no change in UI to distinguish this. As a result, after dialog has closed, it still seems that the user is prompted to Add a new record.This screencast better demonstrates what I mean:
create-suggestion.mov
What I believe should happen is the Autocomplete should blur once we've created the new value and set it as the Autocomplete's value.
The text was updated successfully, but these errors were encountered: