aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorKris Borchers <kris.borchers@gmail.com>2013-08-01 20:41:58 -0500
committerKris Borchers <kris.borchers@gmail.com>2013-08-11 19:17:34 -0500
commit5a24ee048528ef916fce4ce06ab5d3549865f82f (patch)
treedd675d67506c3e683b826b8873461c0bbae6c4bf /ui
parentec61e54e6fcfe33adab09d1ecad8db2edcbad4cc (diff)
downloadjquery-ui-5a24ee048528ef916fce4ce06ab5d3549865f82f.tar.gz
jquery-ui-5a24ee048528ef916fce4ce06ab5d3549865f82f.zip
Selectmenu: Override menu's _closeOnDocumentClick function to prevent collapseAll and manually fix focus state on open
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.selectmenu.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 2b9f41547..bc7eae1bd 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -149,10 +149,13 @@ $.widget( "ui.selectmenu", {
// adjust menu styles to dropdown
this.menu.addClass( "ui-corner-bottom" ).removeClass( "ui-corner-all" );
- // Make sure focus stays on selected item
- this.menuInstance.delay = 999999999;
// Unbind uneeded Menu events
this.menuInstance._off( this.menu, "mouseleave" );
+
+ // Cancel the menu's collapseAll on document click
+ this.menuInstance._closeOnDocumentClick = function() {
+ return false;
+ };
},
refresh: function() {
@@ -185,9 +188,13 @@ $.widget( "ui.selectmenu", {
if ( this.options.disabled ) {
return;
}
+
// Support: IE6-IE9 click doesn't trigger focus on the button
if ( !this.menuItems ) {
this.refresh();
+ } else {
+ this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
+ this.menu.menu( "focus", null, this._getSelectedItem() );
}
this.isOpen = true;
@@ -198,7 +205,7 @@ $.widget( "ui.selectmenu", {
this._trigger( "open", event );
},
-
+
_position: function() {
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
},