mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: fixed unwanted focus events
This commit is contained in:
parent
3ba99cbd6b
commit
37d22ee017
14
ui/jquery.ui.selectmenu.js
vendored
14
ui/jquery.ui.selectmenu.js
vendored
@ -173,7 +173,9 @@ $.widget( "ui.selectmenu", {
|
|||||||
that.close( event, true);
|
that.close( event, true);
|
||||||
},
|
},
|
||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
that._trigger( "focus", event, { item: ui.item.data( "item.selectmenu" ) } );
|
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 ) {
|
_move: function( key, event ) {
|
||||||
// TODO this focus is needed to make the select below work,
|
if ( !this.opened ) this.list.menu( "focus", event, this._getSelectedItem() );
|
||||||
// but should be removed as its fires an unwanted focus event
|
|
||||||
if ( !this.opened ) {
|
|
||||||
this.list.menu( "focus", event, this._getSelectedItem() );
|
|
||||||
}
|
|
||||||
this.list.menu( key, event );
|
this.list.menu( key, event );
|
||||||
if ( !this.opened ) {
|
if ( !this.opened ) this.list.menu( "select", event );
|
||||||
this.list.menu( "select", event );
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSelectedItem: function() {
|
_getSelectedItem: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user