diff options
author | Felix Nagel <info@felixnagel.com> | 2013-10-29 21:49:17 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-10-29 21:49:17 +0100 |
commit | 11186cc10a3decf8fcc236537edc8ca2a61bd176 (patch) | |
tree | cdbb95513e373b9b1b5eacfc9b73d0dacaed3900 /ui | |
parent | 027d8d4cab27b89d3b1b137fbb8ce81c9fdafc54 (diff) | |
download | jquery-ui-11186cc10a3decf8fcc236537edc8ca2a61bd176.tar.gz jquery-ui-11186cc10a3decf8fcc236537edc8ca2a61bd176.zip |
Selectmenu: make sure ui-state-focus class is set on button after initial focus
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 5c13a1619..45d379240 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -56,7 +56,8 @@ $.widget( "ui.selectmenu", { }, _drawButton: function() { - var tabindex = this.element.attr( "tabindex" ); + var that = this, + tabindex = this.element.attr( "tabindex" ); // Associate existing label with the new button this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button ); @@ -96,6 +97,10 @@ $.widget( "ui.selectmenu", { this._setOption( "width", this.options.width ); this._on( this.button, this._buttonEvents ); + this.button.one( "focusin", function() { + // Delay rendering the menu items until the button receives focus + that._refreshMenu(); + }); this._hoverable( this.button ); this._focusable( this.button ); }, @@ -329,13 +334,6 @@ $.widget( "ui.selectmenu", { }, _buttonEvents: { - focusin: function() { - // Delay rendering the menu items until the button receives focus - if ( !this.menuItems ) { - this._refreshMenu(); - } - this._off( this.button, "focusin" ); - }, click: "_toggle", keydown: function( event ) { var preventDefault = true; |