It appears that autocomplete doesn't deal with trailing spaces.

How to reproduce: Create Tag terms "ab" and "a c". Create an article, in the Tags field type "a" - autocomplete suggests both terms. type " " and the autocomplete does't change. In fact the browser never requested more autocomplete results. Typing "c" will correctly show just the "a c" result

Same result with terms "a b" and "a c" - pasting "a c" into Tags field, then deleting the trailing c doesn't change the autocomplete suggestions.

Comments

Everett Zufelt’s picture

Version: 7.x-dev » 8.x-dev
Component: forms system » javascript

I haven't tested this, and would like to point out that completely removing autocomplete in favor of jQuery UI is being considered in #675446: Use jQuery UI Autocomplete.

However, this could make selecting the correct item more difficult, and it may be worthwhile for there to be a fix.

tkoleary’s picture

Issue summary: View changes

Please follow progress on: #2346973: Improve usability, accessibility, and scalability of long select lists

Changing to Select2 may render this issue obsolete

nod_’s picture

Still happening with jquery ui.

tkoleary’s picture

Status: Active » Closed (cannot reproduce)

Cannot reproduce as of beta10

longwave’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Closed (cannot reproduce) » Active

This is still reproducible in D7. This is because of the following regex in autocomplete.js:

  searchString = searchString.replace(/^\s+|\.{2,}\/|\s+$/g, '');

Changing this to the following fixes the issue for me:

  searchString = searchString.replace(/^\s+|\.{2,}\/$/g, '');
abhisaknigam’s picture

Instead off below code :
searchString = searchString.replace(/^\s+|\.{2,}\/|\s+$/g, '');

Try to use this code :
searchString = searchString.replace(/^\s+|\s+$/, '');

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.