mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: Simplify selection of focused item via keyboard
Don't go through menu to select the currently focused item. Renamed _selectMenu() to _selectFocusedItem() for clarity. Closes gh-1224
This commit is contained in:
parent
1272fca9ef
commit
62812d9c67
@ -363,7 +363,7 @@ return $.widget( "ui.selectmenu", {
|
||||
break;
|
||||
case $.ui.keyCode.ENTER:
|
||||
if ( this.isOpen ) {
|
||||
this._selectMenu( event );
|
||||
this._selectFocusedItem( event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.UP:
|
||||
@ -382,7 +382,7 @@ return $.widget( "ui.selectmenu", {
|
||||
break;
|
||||
case $.ui.keyCode.SPACE:
|
||||
if ( this.isOpen ) {
|
||||
this._selectMenu( event );
|
||||
this._selectFocusedItem( event );
|
||||
} else {
|
||||
this._toggle( event );
|
||||
}
|
||||
@ -412,9 +412,10 @@ return $.widget( "ui.selectmenu", {
|
||||
}
|
||||
},
|
||||
|
||||
_selectMenu: function( event ) {
|
||||
if ( !this.menuItems.eq( this.focusIndex ).hasClass( "ui-state-disabled" ) ) {
|
||||
this.menuInstance.select( event );
|
||||
_selectFocusedItem: function( event ) {
|
||||
var item = this.menuItems.eq( this.focusIndex );
|
||||
if ( !item.hasClass( "ui-state-disabled" ) ) {
|
||||
this._select( item.data( "ui-selectmenu-item" ), event );
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user