Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Selectmenu: menu focus reset when menu is closed, prevents issues whe…

…n using keyboard control on button when focusing menu item before
  • Loading branch information...
commit 640d3080eb956752430bfe09ba405a7ff38eace8 1 parent 75cfcf2
@fnagel fnagel authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 ui/jquery.ui.selectmenu.js
View
7 ui/jquery.ui.selectmenu.js
@@ -137,7 +137,7 @@ $.widget( "ui.selectmenu", {
focus: function( event, ui ) {
var item = ui.item.data( "ui-selectmenu-item" );
// prevent inital focus from firing and checks if its a newly focused item
- if ( that.focus !== undefined && item.index !== that.focus ) {
+ if ( !that.isOpen && that.focus !== undefined && item.index !== that.focus ) {
that._trigger( "focus", event, { item: item } );
if ( !that.isOpen ) {
that._select( item, event );
@@ -206,7 +206,10 @@ $.widget( "ui.selectmenu", {
// check if we have an item to select
if ( this.menuItems ) {
- var id = this._getSelectedItem().find( "a" ).attr( "id" );
+ var item = this._getSelectedItem(),
+ id = item.find( "a" ).attr( "id" );
+
+ this.menu.menu( "focus", null, item );
this.button.attr( "aria-activedescendant", id );
this.menu.attr( "aria-activedescendant", id );
}
Please sign in to comment.
Something went wrong with that request. Please try again.