In _autocomplete_widgets_get_options_allowvals the limit on returned autocomplete (usually 10, and a setting parameter would be good for that) is applied with:

    if ($count >= $limit) {
      break;
    }

And later the sort is made with:

_autocomplete_widgets_sort_options($options, $instance);

The conséquence is a really bad user experience where you type for example "samsung" and get a list of 10 samsung mobiles (with 1 or 2 Galaxy inside and some other mobiles - all starting with samsung), and when typing galaxy you have a list of 10 samsung galaxy mobiles. Based on the first typing the user may think the list contains only 2 samsung-galaxy when it can provide 25 of them. This is an example.

But the user experience bug seems quite obvious for me, sort operations should be applied before limiting the result, as done in databases. This may impact badly big lists.

Comments

regilero’s picture

Status: Active » Needs review
StatusFileSize
new1.37 KB

Here's a patch for that.

bleen’s picture

Issue tags: +Needs tests

this fix looks fine to me (except for the minor whitespace issues) ... but it needs tests.

Thanks for submitting this patch