- Issue created by @ericgsmith
- 🇳🇿New Zealand ericgsmith
Ok, looks like there is many discussions in core about this behavior:
I am currently investigating using this module and have found an issue with how core's autocomplete handles "," which results in unexpected results using this plugin.
In my context I am searching for an address - so a common user input might be "123 Foobar street, Fooville"
Viewing the network tab I can see that only the user input after the comma is sent to the backend (e.g "Fooville") which results in a sudden change in the returned results.
This behaviour appears related to how the core autocomplete java script handles inputs.
When the user inputs a value then autocomplete.searchHandler inside autocomplete.js
is called.
This then is calling autocomplete.extractLastTerm which returns only the content after the last occurrence of ,
This is what is then passed to the callback / Autocomplete controller.
Inside search_api_autocomplete.js it looks like we could override the searchHandler option with a custom function that ensure the user input is passed to the backend as entered rather than split.
Active
1.0
General code
Ok, looks like there is many discussions in core about this behavior: