File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -509,17 +509,20 @@ the specific language governing permissions and limitations under the Apache Lic
509509 $document . ready ( function ( ) {
510510 $document . bind ( "mousedown touchend" , function ( e ) {
511511 var target = $ ( e . target ) . closest ( "div.select2-container" ) . get ( 0 ) , attr ;
512+ var targetDropdown = null ;
512513 if ( target ) {
513514 $document . find ( "div.select2-container-active" ) . each ( function ( ) {
514515 if ( this !== target ) $ ( this ) . data ( "select2" ) . blur ( ) ;
515516 } ) ;
516- } else {
517- target = $ ( e . target ) . closest ( "div.select2-drop" ) . get ( 0 ) ;
518- $document . find ( "div.select2-drop-active" ) . each ( function ( ) {
519- if ( this !== target ) $ ( this ) . data ( "select2" ) . blur ( ) ;
520- } ) ;
517+ targetDropdown = $ ( target ) . data ( 'select2' ) . dropdown . get ( 0 ) ;
521518 }
522519
520+ // close any other active dropdowns
521+ target = targetDropdown || $ ( e . target ) . closest ( "div.select2-drop" ) . get ( 0 ) ;
522+ $document . find ( "div.select2-drop-active" ) . each ( function ( ) {
523+ if ( this !== target ) $ ( this ) . data ( "select2" ) . blur ( ) ;
524+ } ) ;
525+
523526 target = $ ( e . target ) ;
524527 attr = target . attr ( "for" ) ;
525528 if ( "LABEL" === e . target . tagName && attr && attr . length > 0 ) {
You can’t perform that action at this time.
0 commit comments