items.children( "a" )
.addClass( "ui-corner-all" )
- .attr( "tabIndex", -1 );
+ .attr( "tabIndex", -1 )
+ .attr( "role", "menuitem" )
+ .attr("id", function(i) {return self.element.attr("id") + "-" + i});
+
+ submenus.each(function() {
+ var menu = $(this);
+ var item = menu.prev("a")
+ item.attr("aria-haspopup", "true")
- .prepend('<span class="ui-icon ui-icon-carat-1-e"></span>');
++ .prepend('<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>');
+ menu.attr("aria-labelledby", item.attr("id"));
+ });
},
focus: function( event, item ) {
this.active = item.first()
.children( "a" )
.addClass( "ui-state-focus" )
- .attr( "id", function(index, id) {
- return (self.itemId = id || self.menuId + "-activedescendant");
- })
.end();
- // need to remove the attribute before adding it for the screenreader to pick up the change
- // see http://groups.google.com/group/jquery-a11y/msg/929e0c1e8c5efc8f
- this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId)
+ self.element.attr("aria-activedescendant", self.active.children("a").attr("id"))
+
+ // highlight active parent menu item, if any
+ this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");
self.timer = setTimeout(function() {
self._close();
? this.options.position(this.active)
: this.options.position
);
-
- submenu.show().position(position);
+ submenu.show().removeAttr("aria-hidden").attr("aria-expanded", "true").position(position);
- this.active.find(">a:first").addClass("ui-state-active");
},
closeAll: function() {