Skip to main content

Search and Top Navigation

#7032 closed feature (fixed)

Opened February 23, 2011 12:47PM UTC

Closed March 15, 2011 12:42PM UTC

Last modified March 15, 2011 12:44PM UTC

Autocomplete: Add option to automatically highlight the first result

Reported by: dziastinux Owned by:
Priority: blocker Milestone: 1.8.11
Component: ui.autocomplete Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:
Description

I have no privilege to reopen #5674, so I am creating new ticket.

Quick and dirty example: http://jsfiddle.net/Kgx3J/32/show/

Type 'a' to see suggestions.

It can be done even better, no need to brake anything :)


Adding notes since there are lots of comments and these are important:

  • The option should be named autoFocus
  • We have to track down the race condition described in the extension
Attachments (0)
Change History (22)

Changed February 23, 2011 12:51PM UTC by dziastinux comment:1

Changed February 23, 2011 01:07PM UTC by scottgonzalez comment:2

type: bugfeature

This actually does create a significant change in behavior. Typing "a" followed by tab or enter has very different behavior than existing releases.

Changed February 23, 2011 01:13PM UTC by dziastinux comment:3

Tab and Enter suppose to select currently active item (it still works in my example) so I can't see significant change in behavior.

P.s. It is possible that 'selectFirst' primary use case is to force user to select item from the list.

Changed February 23, 2011 01:26PM UTC by scottgonzalez comment:4

Yes, tab and enter act as you expect, but this is a change in behavior from existing releases. It was previously easy to type any value you want, ignoring the suggestions. The autocomplete is passive in existing releases and this change would make it aggressive in the sense that you have to explicitly opt-out of selecting a value.

Changed February 23, 2011 01:35PM UTC by dziastinux comment:5

_comment0: Not exactly true. You selectFirst still allows to enter custom value, but now there are two cases: \ 1. User wants to enter sub-part of suggestion; \ 2. User wants to enter completely different value (from all the suggestions). \ \ In 1st case user has two options: select one of the suggestions or press Esc and enter custom value. \ In 2nd case user feels no discomfort (as soon as no items are matched autocomplete menu is closed and further behavior is identical to v1.8.9). \ \ What have I missed? \ \ 1298468143910310

Not exactly true. You selectFirst still allows to enter custom value, but now there are two cases:

1. User wants to enter sub-part of suggestion;

2. User wants to enter completely different value (from all the suggestions).

In 1st case user has two options: select one of the suggestions or press Esc and enter custom value.

In 2nd case user feels no discomfort (as soon as no items are matched autocomplete menu is closed and further behavior is identical to v1.8.9).

What have I missed?

Changed February 23, 2011 01:41PM UTC by scottgonzalez comment:6

What I'm saying is that case 1 is a significant change in the behavior.

Changed February 23, 2011 01:49PM UTC by dziastinux comment:7

For user - yes. But that is the reason why it should be an option (developer decides whether to enable or not).

P.s. HTML options tag selects first item by default (no way to unselect). So users are used to it.

Changed February 24, 2011 09:45AM UTC by scottgonzalez comment:8

Why is the existing extension not suitable?

Changed February 24, 2011 11:46AM UTC by dziastinux comment:9

I am just saying that it wouldn't be to complicate to implement this option.

Changed February 24, 2011 11:53AM UTC by scottgonzalez comment:10

resolution: → wontfix
status: newclosed

Just because it's easy to implement something doesn't mean it should be in the core of the plugin. Autocomplete would easily have 30 options if we implemented all of the small features. The team's view on this is still that it is not common enough to add this option. If the extension becomes popular enough, we can add it to the official plugin.

Changed February 25, 2011 05:49AM UTC by dziastinux comment:11

_comment0: No offense but it looks that you are doing your best to postpone/avoid implementing this feature no matter the reason. \ \ It would be nice to have this feature option in the autocomplete demo (let's say, combined to existing combobox demo). Am I asking too much?1298613011864786
_comment1: No offense but it looks that you are doing your best to postpone/avoid implementing this feature no matter the reason. \ \ Still it would be nice to have this feature option in the autocomplete demo (let's say, combined with existing combobox demo). Am I asking too much?1298613047898307

No offense but it looks that you are doing your best to postpone/avoid implementing this feature no matter the reason.

Still it would be nice to have this feature in the autocomplete demo (let's say, combined with existing combobox demo). Am I asking too much?

Changed February 25, 2011 09:07AM UTC by scottgonzalez comment:12

_comment0: The only reason features are added are: 1) they become popular, 2) they are needed in order for users to built some other feature. \ \ Adding a demo doesn't address your issue of wanting this built-in. In fact, the existing extensions servers your actual needs better since an official demo would implement the functionality as a one-off implementation, not as a new option.1298624911100384

The only reason features are added are: 1) they become popular, 2) they are needed in order for users to build some other feature.

Adding a demo doesn't address your issue of wanting this built-in. In fact, the existing extension servers your actual needs better since an official demo would implement the functionality as a one-off implementation, not as a new option.

Changed February 26, 2011 12:54PM UTC by akantro comment:13

_comment0: First of all. \ \ 1. This was the existing behavior of the previous autocomplete plugin that this plugin is "trying" to decomission. \ 2. This option "selectFirst" is in the old plugin and is in the behavior in most every other autocomplete plugin (fcbkcomplete, etc) and mimics the experience you get in a) all facebook dropdown autocompletes, b)stackoverflow autocomplete (for tags) which represents about 550 Million people so i would argue that this constitute "popular" \ 3. This allows the user experience to be much quicker as you can start entering a value and just click enter and then start typing the next entry (in multiple mode). Again refer to facebook or stackoverflow for example of usage.1298724973711317
_comment1: First of all. \ \ 1. This was the existing behavior of the [previous autocomplete plugin|http://docs.jquery.com/Plugins/autocomplete] that this plugin is "trying" to decomission. \ 2. This option "selectFirst" is in the old plugin and is in the behavior in most every other autocomplete plugin (fcbkcomplete, etc) and mimics the experience you get in a) all facebook dropdown autocompletes, b)stackoverflow autocomplete (for tags) which represents about 550 Million people so i would argue that this constitute "popular" \ 3. This allows the user experience to be much quicker as you can start entering a value and just click enter and then start typing the next entry (in multiple mode). Again refer to facebook or stackoverflow for example of usage.1298725041809574

First of all.

1. This was the existing behavior of the autocomplete plugin that this plugin is "trying" to decomission.

2. This option "selectFirst" is in the old plugin and is in the behavior in most every other autocomplete plugin (fcbkcomplete, etc) and mimics the experience you get in a) facebook dropdown autocompletes, b)[http://www.stackoverflow.com/|stackoverflow autocomplete] (for tags) which represents about 550 Million people so i would argue that this constitute "popular"

3. This allows the user experience to be much quicker as you can start entering a value and just click enter and then start typing the next entry (in multiple mode). Again refer to facebook or stackoverflow for example of usage.

Changed February 26, 2011 01:32PM UTC by scottgonzalez comment:14

milestone: 1.91.8.11
priority: minorblocker
resolution: wontfix
status: closedreopened
summary: Select first item when list opensAutocomplete: Add option to automatically highlight the first result

Thanks for bringing up those points. They definitely make a compelling argument that this should be included in the core. In fact it's compelling enough that we'll default to enabling this in 1.9. In the meantime, we will add the option now (for 1.8.11) but have it off by default in order to not break back-compat in a minor release.

Thanks again.

Changed February 26, 2011 01:38PM UTC by scottgonzalez comment:15

status: reopenedopen

The new option should be called autoFocus to indicate that it is just focusing and not selecting. This also matches the naming of autoSelect (even though autoSelect isn't built in).

Changed March 09, 2011 02:44PM UTC by scottgonzalez comment:16

description: I have no privilege to reopen #5674, so I am creating new ticket. \ \ Quick and dirty example: http://jsfiddle.net/Kgx3J/32/show/ \ Type 'a' to see suggestions. \ It can be done even better, no need to brake anything :)I have no privilege to reopen #5674, so I am creating new ticket. \ \ Quick and dirty example: http://jsfiddle.net/Kgx3J/32/show/ \ Type 'a' to see suggestions. \ It can be done even better, no need to brake anything :) \ \ ---- \ Adding notes since there are lots of commentes and these are important: \ - The option should be named autoFocus \ - We have to track down the race condition described in [https://github.com/scottgonzalez/jquery-ui-extensions/issues#issue/1 the extension] \

Changed March 09, 2011 02:45PM UTC by scottgonzalez comment:17

description: I have no privilege to reopen #5674, so I am creating new ticket. \ \ Quick and dirty example: http://jsfiddle.net/Kgx3J/32/show/ \ Type 'a' to see suggestions. \ It can be done even better, no need to brake anything :) \ \ ---- \ Adding notes since there are lots of commentes and these are important: \ - The option should be named autoFocus \ - We have to track down the race condition described in [https://github.com/scottgonzalez/jquery-ui-extensions/issues#issue/1 the extension] \ I have no privilege to reopen #5674, so I am creating new ticket. \ \ Quick and dirty example: http://jsfiddle.net/Kgx3J/32/show/ \ Type 'a' to see suggestions. \ It can be done even better, no need to brake anything :) \ \ ---- \ Adding notes since there are lots of comments and these are important: \ - The option should be named autoFocus \ - We have to track down the race condition described in [https://github.com/scottgonzalez/jquery-ui-extensions/issues#issue/1 the extension] \

Changed March 15, 2011 09:40AM UTC by Richard Worth comment:18

resolution: → fixed
status: openclosed

Autocomplete: new option autoFocus, default false. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result

Changeset: 09215ef2cda488cafa92c42a8c63e2f1131147d0

Changed March 15, 2011 09:43AM UTC by Richard Worth comment:19

Autocomplete: new option autoFocus, default false. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result

Changeset: 779df6517d4e1bdd7ed3667537adb67c7443d15f

Changed March 15, 2011 11:59AM UTC by scottgonzalez comment:20

resolution: fixed
status: closedreopened

This needs tests.

Changed March 15, 2011 12:42PM UTC by Richard Worth comment:21

resolution: → fixed
status: reopenedclosed

Autocomplete: added unit tests for autoFocus. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result

Changeset: 56b7ec134d8e1203f700f99dabcdad8c50a9b0c2

Changed March 15, 2011 12:44PM UTC by Richard Worth comment:22

Autocomplete: added unit tests for autoFocus. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result

(cherry picked from commit 56b7ec134d8e1203f700f99dabcdad8c50a9b0c2)

Changeset: 218100e7042cdf0a27fd1f3b7a954944878838f9