Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

The alternatives are only visible if the user enters a valid first character #26

Closed
jaklithn opened this issue Jun 9, 2017 · 3 comments
Labels

Comments

@jaklithn
Copy link

jaklithn commented Jun 9, 2017

In my case I have a small number of alternatives that the user does NOT know beforehand. This causes a problem as the user can not see the alternatives until a first matching character is entered! I tried to modify the searchMinLength option but it made no effect.

After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:

if(this.input.val().length > 0){
    this.trigger('tokenize:search', [this.input.val()]);
}

My interpretation is that the internal search command is not triggered unless the user input has at least one character. I think this should be modified to be:

if(this.input.val().length >= this.options.searchMinLength){
    this.trigger('tokenize:search', [this.input.val()]);
}
@kevinjavitz
Copy link

kevinjavitz commented Feb 7, 2022

This issue is back in the code again, any reason why? It is nice to be able to mouse in and have the drop down populate in some cases where the user doesn't know what to type to start.

https://github.com/dragonofmercy/Tokenize2/blob/master/tokenize2.js#L151
https://github.com/dragonofmercy/Tokenize2/blob/master/tokenize2.js#L540

I removed && this.input.val().length > 0 from both of these and it works good for me

@dragonofmercy
Copy link
Owner

@salesigniter have a look here #75

@kevinjavitz
Copy link

Thanks, I still don't understand the reasons behind the && this.input.val().length > 0 being there AND searchMinLength being able to be set to 0, but anyways I removed && this.input.val().length > 0 from those 2 lines and set searchMinLength to 0 and it works perfect

The comment you point to is talking about adding an additional event click handler which is not really necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants