@@ -1135,17 +1135,14 @@ the specific language governing permissions and limitations under the Apache Lic
11351135 orient = "orientationchange." + cid ,
11361136 mask ;
11371137
1138- this . clearDropdownAlignmentPreference ( ) ;
1139-
11401138 this . container . addClass ( "select2-dropdown-open" ) . addClass ( "select2-container-active" ) ;
11411139
1140+ this . clearDropdownAlignmentPreference ( ) ;
11421141
11431142 if ( this . dropdown [ 0 ] !== this . body ( ) . children ( ) . last ( ) [ 0 ] ) {
11441143 this . dropdown . detach ( ) . appendTo ( this . body ( ) ) ;
11451144 }
11461145
1147- this . updateResults ( true ) ;
1148-
11491146 // create the dropdown mask if doesnt already exist
11501147 mask = $ ( "#select2-drop-mask" ) ;
11511148 if ( mask . length == 0 ) {
@@ -1193,8 +1190,6 @@ the specific language governing permissions and limitations under the Apache Lic
11931190 } ) ;
11941191 } ) ;
11951192
1196- this . focusSearch ( ) ;
1197-
11981193 function _makeMaskCss ( ) {
11991194 return {
12001195 width : Math . max ( document . documentElement . scrollWidth , $ ( window ) . width ( ) ) ,
@@ -1663,8 +1658,12 @@ the specific language governing permissions and limitations under the Apache Lic
16631658 // single
16641659 opening : function ( ) {
16651660 this . parent . opening . apply ( this , arguments ) ;
1666- this . focusser . attr ( "disabled" , "disabled" ) ;
1667-
1661+ if ( this . showSearchInput !== false ) {
1662+ this . search . val ( this . focusser . val ( ) ) ;
1663+ }
1664+ this . search . focus ( ) ;
1665+ this . focusser . attr ( "disabled" , "disabled" ) . val ( "" ) ;
1666+ this . updateResults ( true ) ;
16681667 this . opts . element . trigger ( $ . Event ( "open" ) ) ;
16691668 } ,
16701669
@@ -1785,13 +1784,9 @@ the specific language governing permissions and limitations under the Apache Lic
17851784
17861785 installKeyUpChangeEvent ( this . focusser ) ;
17871786 this . focusser . bind ( "keyup-change input" , this . bind ( function ( e ) {
1787+ e . stopPropagation ( ) ;
17881788 if ( this . opened ( ) ) return ;
17891789 this . open ( ) ;
1790- if ( this . showSearchInput !== false ) {
1791- this . search . val ( this . focusser . val ( ) ) ;
1792- }
1793- this . focusser . val ( "" ) ;
1794- killEvent ( e ) ;
17951790 } ) ) ;
17961791
17971792 selection . delegate ( "abbr" , "mousedown" , this . bind ( function ( e ) {
@@ -2354,6 +2349,8 @@ the specific language governing permissions and limitations under the Apache Lic
23542349
23552350 this . focusSearch ( ) ;
23562351
2352+ this . updateResults ( true ) ;
2353+ this . search . focus ( ) ;
23572354 this . opts . element . trigger ( $ . Event ( "open" ) ) ;
23582355 } ,
23592356
0 commit comments