Skip to content

Commit adf80bf

Browse files
author
maggiewachs
committed
Added active state toggle to items with submenus to provide "breadcrumb" feedback
1 parent 9e7820a commit adf80bf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ui/jquery.ui.menu.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,13 @@ $.widget("ui.menu", {
213213
.end();
214214
// need to remove the attribute before adding it for the screenreader to pick up the change
215215
// see http://groups.google.com/group/jquery-a11y/msg/929e0c1e8c5efc8f
216-
this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId);
217-
216+
this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId)
217+
218218
self._close();
219219
var nested = $(">ul", item);
220220
if (nested.length && /^mouse/.test(event.type)) {
221221
self._open(nested);
222+
this.active.find(">a:first").addClass("ui-state-active");
222223
}
223224
this.activeMenu = item.parent();
224225

@@ -229,7 +230,7 @@ $.widget("ui.menu", {
229230
if (!this.active) {
230231
return;
231232
}
232-
233+
233234
this.active.children( "a" ).removeClass( "ui-state-focus" );
234235
// remove only generated id
235236
$( "#" + this.menuId + "-activedescendant" ).removeAttr( "id" );
@@ -261,7 +262,9 @@ $.widget("ui.menu", {
261262
},
262263

263264
_close: function() {
264-
this.active.parent().find("ul").hide();
265+
this.active.parent()
266+
.find("ul").hide().end()
267+
.find("a.ui-state-active").removeClass("ui-state-active");
265268
},
266269

267270
left: function(event) {

0 commit comments

Comments
 (0)