chosen icon indicating copy to clipboard operation
chosen copied to clipboard

repeated click will not show list

Open applibs opened this issue 3 years ago • 3 comments

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.

applibs avatar Mar 09 '21 20:03 applibs

There's a setting for that:

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

blackdrago avatar Mar 18 '21 18:03 blackdrago

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 avatar Mar 18 '21 19:03 applibs

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();
            }
        };

applibs avatar Nov 06 '23 08:11 applibs