Meteor-Community-Packages / meteor-autocomplete

Client/server autocompletion designed for Meteor's collections and reactivity.
https://atmospherejs.com/mizzao/autocomplete
MIT License
350 stars 107 forks source link

Add autoSelect top-level option #73

Open nmaquet opened 9 years ago

nmaquet commented 9 years ago

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).

mizzao commented 9 years ago

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?

nmaquet commented 9 years ago

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.

todda00 commented 9 years ago

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 commented 9 years ago

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

leizard commented 8 years ago

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

c0811g0911 commented 8 years ago

+1 agree with this change

mizzao commented 8 years ago

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.

nmaquet commented 8 years ago

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

mizzao commented 8 years ago

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.

rkgomekar commented 8 years ago

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