Skip to content

Commit 27049fc

Browse files
committed
Selectmenu: improve initial refresh method call
1 parent ba73886 commit 27049fc

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,6 @@ $.widget( "ui.selectmenu", {
184184
},
185185

186186
open: function( event ) {
187-
// init menu when initial opened
188-
if ( !this.wasOpen ) {
189-
this.refresh();
190-
this.wasOpen = true;
191-
}
192-
193187
var currentItem = this._getSelectedItem();
194188

195189
if ( !this.options.disabled ) {
@@ -284,11 +278,6 @@ $.widget( "ui.selectmenu", {
284278
},
285279

286280
_move: function( direction, event ) {
287-
// init menu when not done yet
288-
if ( !this.wasOpen ) {
289-
this.refresh();
290-
this.wasOpen = true;
291-
}
292281
if ( direction == "first" || direction == "last" ) {
293282
// set focus manually for first or last item
294283
this.menu.menu( "focus", event, this.menu.find( "li" ).not( '.ui-selectmenu-optgroup' )[ direction ]() );
@@ -320,6 +309,11 @@ $.widget( "ui.selectmenu", {
320309
},
321310

322311
_buttonEvents: {
312+
// init Menu on first focus
313+
focus: function( event ) {
314+
this.refresh();
315+
this.button.unbind( "focus." + this.widgetName )
316+
},
323317
click: function( event ) {
324318
this._toggle( event );
325319
event.preventDefault();

0 commit comments

Comments
 (0)