aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2011-10-06 01:09:12 +0200
committerFelix Nagel <info@felixnagel.com>2011-10-06 01:09:12 +0200
commit37d22ee017f3d90080bb5acb867889fb4e50edbc (patch)
tree65dcd185a6907112edc10d4508c4ee4b1c53d812
parent3ba99cbd6b7250b88b8a4faf986f1ae81c56774d (diff)
downloadjquery-ui-37d22ee017f3d90080bb5acb867889fb4e50edbc.tar.gz
jquery-ui-37d22ee017f3d90080bb5acb867889fb4e50edbc.zip
Selectmenu: fixed unwanted focus events
-rw-r--r--ui/jquery.ui.selectmenu.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index f00acf41a..f161c9bc7 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -172,8 +172,10 @@ $.widget( "ui.selectmenu", {
that.close( event, true);
},
- focus: function( event, ui ) {
- that._trigger( "focus", event, { item: ui.item.data( "item.selectmenu" ) } );
+ focus: function( event, ui ) {
+ var item = ui.item.data( "item.selectmenu" );
+ if ( that.focus !== undefined && item.index != that.focus ) that._trigger( "focus", event, { item: item } );
+ that.focus = item.index;
}
});
},
@@ -302,15 +304,9 @@ $.widget( "ui.selectmenu", {
},
_move: function( key, event ) {
- // TODO this focus is needed to make the select below work,
- // but should be removed as its fires an unwanted focus event
- if ( !this.opened ) {
- this.list.menu( "focus", event, this._getSelectedItem() );
- }
+ if ( !this.opened ) this.list.menu( "focus", event, this._getSelectedItem() );
this.list.menu( key, event );
- if ( !this.opened ) {
- this.list.menu( "select", event );
- }
+ if ( !this.opened ) this.list.menu( "select", event );
},
_getSelectedItem: function() {