Hi Drupal Core, here's a suggestion for better user functionality.
- Turn the return value of autocomplete.js into an array.
- When selected, autocomplete.js fills in the textfield with the value of the array_key instead of the full array.
- The array_key would be specified in the feeding function value.
Where would we use this?
User autocomplete with pictures.
Autocomplete works on strings. Find a string, make an array with strings, return the strings. This seems pretty limited for user experience. We would have to change code like
this.input.value = $(node).data('autocompleteValue'); to look for the main field. The HTML would have to be structured too.
In a perfect world, we could do this in D7. If there's no "main-field" specified, return to normal behaviour.
Sample HTML return
(not including the ARIA)
<div id='autocomplete-0' class= 'autocompleteValue'>
<div class="field-1 main-field">AAA</div>
<div id='autocomplete-1' class= 'autocompleteValue'>
<div class="field-1 main-field">BBB</div>
What do you think?