aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.selectmenu.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-02-13 22:42:05 +0100
committerFelix Nagel <info@felixnagel.com>2013-02-13 22:42:05 +0100
commit640d3080eb956752430bfe09ba405a7ff38eace8 (patch)
treed4cfef9fbf5299a03a6a8ae63c70806815851733 /ui/jquery.ui.selectmenu.js
parent75cfcf223588100fe796457170c5a6634c0185d0 (diff)
downloadjquery-ui-640d3080eb956752430bfe09ba405a7ff38eace8.tar.gz
jquery-ui-640d3080eb956752430bfe09ba405a7ff38eace8.zip
Selectmenu: menu focus reset when menu is closed, prevents issues when using keyboard control on button when focusing menu item before
Diffstat (limited to 'ui/jquery.ui.selectmenu.js')
-rw-r--r--ui/jquery.ui.selectmenu.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index e26850c2c..e6d0a2590 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/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 );
}