aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.selectmenu.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-02-13 23:07:25 +0100
committerFelix Nagel <info@felixnagel.com>2013-02-13 23:07:25 +0100
commit8a5e8696adb20dbd8ce2daac91b061130d6543f4 (patch)
tree896627157c7f0bcf1a26647ba4bf80b5e8933fe6 /ui/jquery.ui.selectmenu.js
parent640d3080eb956752430bfe09ba405a7ff38eace8 (diff)
downloadjquery-ui-8a5e8696adb20dbd8ce2daac91b061130d6543f4.tar.gz
jquery-ui-8a5e8696adb20dbd8ce2daac91b061130d6543f4.zip
Selectmenu: aria-activedescendant should be set when item is selected, not when menu is closed
Diffstat (limited to 'ui/jquery.ui.selectmenu.js')
-rw-r--r--ui/jquery.ui.selectmenu.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index e6d0a2590..69ea12e26 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -206,12 +206,7 @@ $.widget( "ui.selectmenu", {
// check if we have an item to select
if ( this.menuItems ) {
- 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 );
+ this.menu.menu( "focus", null, this._getSelectedItem() );
}
this._trigger( "close", event );
@@ -377,10 +372,17 @@ $.widget( "ui.selectmenu", {
},
_setAria: function( item ) {
+ var link = this.menuItems.eq( item.index ).find( "a" ),
+ id = link.attr( "id" );
+
// change ARIA attr
this.menuItems.find( "a" ).attr( "aria-selected", false );
- this.menuItems.eq( item.index ).find( "a" ).attr( "aria-selected", true );
- this.button.attr( "aria-labelledby", this.menuItems.eq( item.index ).find( "a" ).attr( "id" ) );
+ link.attr( "aria-selected", true );
+ this.button.attr({
+ "aria-labelledby": id,
+ "aria-activedescendant": id
+ });
+ this.menu.attr( "aria-activedescendant", id );
},
_setOption: function( key, value ) {