[v2.x] AutocompleteInput should accept selection on Enter
Not sure if this is a bug or is intended.
User context
My users would navigate up and down the suggestion list using the UpArrow and DownArrow key. When they see their desired choice, they hit Enter. However, that choice/that selection is not recorded. The only to way to record it is to reach for the mouse and click on the item.
My troubleshooting
I went into the source code of AutocompleteInput v2.x and found this code is what causes that behavior:
handleChange = (event, { newValue, method }) => {
if (['type', 'click', 'escape'].includes(method)) {
this.handleMatchSuggestionOrFilter(newValue);
}
};
When I added enter to the trio, I got the behavior that my users want:
if (['type', 'click', 'escape', 'enter'].includes(method)) {
My ask
Before viewing this as a bug or a feature request, I'd love to know if react-admin team had some rationale for including these 3 methods but not the enter method. I'm considering, if it's not possible to add enter in react-admin source code, I probably will have to copy the implementation of AutocompleteInput to my project to override just that single line.
Some gifs to illustrate:
Before fix:

After fix:

Hi @thoat Can you make that fix into a pull request? I haven't checked the code, so I don't know if that's the best way to go
Hi @thoat , This feature exists in the version I'm using (3.1.2). Try updating your react-admin version