From 8a5e8696adb20dbd8ce2daac91b061130d6543f4 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 13 Feb 2013 23:07:25 +0100 Subject: Selectmenu: aria-activedescendant should be set when item is selected, not when menu is closed --- ui/jquery.ui.selectmenu.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ui/jquery.ui.selectmenu.js') 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 ) { -- cgit v1.2.3