harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.85k stars 4.1k forks source link

repeated click will not show list #3115

Open applibs opened 3 years ago

applibs commented 3 years ago

When I click on chosen initialized element it will show me my list and I will select one item - OK My selected item is visible in box - OK

I want to select another one from list, but after click list will not show. I must click outside ot that element and then click inside again and then it will show my list options. Its bad.

blackdrago commented 3 years ago

There's a setting for that:

$('#someFieldName').chosen({ hide_results_on_select: false });

applibs commented 3 years ago

You described different functionality.

Problem is that when I select anything from list it will make focus to ".search-field.chosen-search-input". For me is expected when its lost focus (blur) and I will click / initiate focus by click -> It will show me rest items from list I select another item.

New setting like "leaveAfterSelected" which will do it, will be nice.

applibs commented 1 year ago

I found solution: My function "search_results_mouseup" looks like this working solution:

Chosen.prototype.search_results_mouseup = function (evt) {
            var target;
            target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
            if (target.length) {
                this.result_highlight = target;
                this.result_select(evt);
                if(this.is_multiple) {
                    return this.close_field();
                }
                return this.search_field.focus();
            }
        };