Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If minChars value is set to 0, display:none on autocomplete-suggestion does not work properly. #56

Open
nits41089 opened this issue Dec 8, 2017 · 0 comments · May be fixed by #95
Open

Comments

@nits41089
Copy link

nits41089 commented Dec 8, 2017

mousedown event on element

.autocomplete-suggestion

propagates back to input field which triggers focus.

        live('autocomplete-suggestion', 'mousedown', function(e){
           if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
                var v = this.getAttribute('data-val');
                that.value = v;
                o.onSelect(e, v, this);
                that.sc.style.display = 'none';
            }
        }, that.sc);

On focus the below event is triggered, because of which .autocomplete-suggestion is again visible.

if (!o.minChars) addEvent(that, 'focus', that.focusHandler);

To avoid this I have added e.preventDefault(); in live('autocomplete-suggestion', 'mousedown', function(e){...} function.
Please see if you can recreate and provide a better solution for this.

@cyfung1031 cyfung1031 linked a pull request Oct 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant