Active
Project:
Drupal core
Version:
main
Component:
forms system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Aug 2017 at 14:18 UTC
Updated:
30 Aug 2021 at 11:15 UTC
Jump to comment: Most recent
The form #autocomplete_route allows and module developer to create an autocomplete using a route (with optional parameters) by creating a controller that serves an array inside a JsonResponse on that route. However, there are some major limitations to the system that cannot be worked around:
Drupal.autocomplete, which is commented with // Exposes options to allow overriding by contrib. is global, so any changes have to be applied globally. This causes a number of limitations that are impossible to work around...select, you have to replace it with something that either also does the behaviour of the current one or calls the current one, except in the specific circumstances where you want something different.minLength is global, there is no way to have a callback that should have a longer minimum length if the page also has an autocomplete where 1 is an appropriate length.data-autocomplete-first-character-blacklist actually gets set to the global options, not a per instance override as the documentation states...I would suggest there are two things worth doing to improve it:
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tacituseu commentedCheck #2346973: Improve usability, accessibility, and scalability of long select lists, AFAIR it included some rework of the mentioned code/issues.
You should also be able to use jQuery UI events (event-select).
Comment #3
tacituseu commentedUps...