aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2014-04-08 11:20:38 -0400
committerScott González <scott.gonzalez@gmail.com>2014-04-18 12:37:06 -0400
commit62812d9c670a5e595e12cae454000231c3f591f3 (patch)
tree46083b2ad442bd43dc2d85283b0e41e0330a5e95
parent1272fca9eff68de09c4d71b68a6de79c8baae276 (diff)
downloadjquery-ui-62812d9c670a5e595e12cae454000231c3f591f3.tar.gz
jquery-ui-62812d9c670a5e595e12cae454000231c3f591f3.zip
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
-rw-r--r--ui/selectmenu.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/selectmenu.js b/ui/selectmenu.js
index a612d1982..7fc2119cb 100644
--- a/ui/selectmenu.js
+++ b/ui/selectmenu.js
@@ -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 );
}
},