meteor-autocomplete icon indicating copy to clipboard operation
meteor-autocomplete copied to clipboard

Add autoSelect top-level option

Open nmaquet opened this issue 10 years ago • 10 comments

Adds a new autoSelect boolean option (default is true) that controls whether the first search result should be automatically selected or not. Setting it to false is useful when using token-less autocompletion for a search input (user can enter an arbitrary string and ignore the autocomplete).

nmaquet avatar Jan 01 '15 05:01 nmaquet

Are you saying that the user pressing Tab or Enter will select an unwanted result by accident? Is it getting in the way of principle of least surprise?

mizzao avatar Feb 27 '15 20:02 mizzao

This is really only useful when using token-less autocomplete in a field where only a predefined set of values are allowed. For instance, you can add autocomplete on a "city" field with hundreds of possible values. Setting autoselect to true in that case guarantees that the user always selects a valid option. This is akin to how a dropdown works.

nmaquet avatar Mar 05 '15 20:03 nmaquet

I am looking for this exact setting as well, I will test this pull to make sure it works for my use case, which is to provide search string suggestions, but not force the user to select one of the options. Currently typing in whatever you want to search for and clicking enter will select the first option.

todda00 avatar Jun 17 '15 20:06 todda00

This works perfectly for my situation. I merged this locally with the master branch and it worked as expected.

todda00 avatar Jun 17 '15 20:06 todda00

+1. I think this should be merge to the master branch. I have the exact context and want to disable auto select top option

leizard avatar Apr 19 '16 07:04 leizard

+1 agree with this change

c0811g0911 avatar Apr 19 '16 07:04 c0811g0911

Hey @nmaquet, I apologize for the delay in responding.

I don't have time to maintain this project anymore, so I gave you commit access to make any changes you'd like. It would be nice to follow the style used by the rest of the code and add some tests to this patch.

If you'd like permission to publish the package to Meteor as well, please send me your Meteor username.

mizzao avatar Jun 29 '16 15:06 mizzao

Thanks, @mizzao! I'm not actually using Meteor that much currently but I'll do my best in maintaining the repo and / or finding someone who'd be willing to maintain it. My meteor account is https://atmospherejs.com/tinsik

nmaquet avatar Jun 29 '16 23:06 nmaquet

Great, you are now a maintainer: https://atmospherejs.com/mizzao/autocomplete .

No pressure to do anything, it's just if you are interested and willing.

mizzao avatar Jun 30 '16 15:06 mizzao

I tried autoSelect :false and autoSelect : "false" Didn't work

rkgomekar avatar Oct 07 '16 09:10 rkgomekar