-
-
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
AutocompleteInput with Create, autoSelect not working #9813
Comments
Thank you for your report. |
I updated the example provided adding Screen.Recording.2024-05-15.at.10.11.34.movIn the video, the first time I try to select an item from the list with the mouse it disappears when the autocomplete component loses focus. The second time, I use the |
Thanks for the additional information. |
What you were expecting:
Using the
AutocompleteInput
component withonCreate
function,autoSelect
andautoHighlight
.I expect that when the user clicks on an option, that option will be selected and will stay selected when the component loses focus.
What happened instead:
When the user clicks the
TAB
key, the behaviour is the expected one, the highlighted choice gets selected and when the component loses focus, the choice is still selected. But when the user clicks with the mouse one option, this one disappears when the components lose focus. This only happens whenautoSelect
orautoHighlight
are passed as props.Steps to reproduce:
use the
AutocompleteInput
component with anonCreate
function to allow the user to create new choices, and theautoSelect
andautoHighlight
.Related code:
https://stackblitz.com/edit/github-g9msfs?file=src%2Fposts%2FPostCreate.tsx
To reproduce the bug in this example provided, navigate to the create screen of a post, try to select a choice with your mouse from the "test" field and then click somewhere else to make the component lose focus.
alternatively, here is the code snipped to reproduce the error
and use it inside a
SimpleForm
:Other information:
Environment
The text was updated successfully, but these errors were encountered: