Type=hidden single select with allowClear opens when clear button is pushed #386

wants to merge 3 commits into


None yet
2 participants

slobo commented Sep 6, 2012

This is inconsistent with how based single select works. This patch makes hidden input based single select behave in the same way - selection is only cleared and we don't open the select for searching.


ivaynberg commented Sep 10, 2012

any chance for a jsfiddle that repros the issues with 3.2? ive been trying to find the time but couldnt yet.

slobo commented Sep 10, 2012

It's a problem with jQuery 1.6 (1.7 and 1.8 seem to work fine): http://jsfiddle.net/rSatf/1/
Here it is running with my patch and jQ1.6: http://jsfiddle.net/rSatf/2/

wonder if we can use stopImmedatePropagation() instead of this flag. would be cleaner...

slobo commented Sep 12, 2012

Yes, the flag is ugly. stopImmediatePropagation() works. I can make a patch that puts it in killEvent() function, or do you want to localize it to "abbr" mousedown?

slobo commented Sep 12, 2012

btw, here it is with stopImmediatePropagation() (select2.js inlined) http://jsfiddle.net/rSatf/5/


ivaynberg commented Sep 12, 2012

i think i would rather see a killEventImmediately() helper and that used in the abbr

slobo commented Sep 12, 2012

Turns out e.stopImmediatePropagation() ie enough, and it's aready being used elsewhere so i didn't factor it out into separate function. 695279a

slobo commented Sep 12, 2012

Here's a demonstration with code from the new branch: http://jsfiddle.net/rSatf/6/

ivaynberg closed this in 6690cc4 Sep 12, 2012

slobo commented Sep 13, 2012

@ivaynberg you need to move the event binding for attr above general mousedown for it to work in jQ1.6. There is still the problem http://jsfiddle.net/rSatf/7/


ivaynberg commented Sep 13, 2012

how about now?

slobo commented Sep 15, 2012

Perfect, thanks for all the effort! http://jsfiddle.net/rSatf/8/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment