From d2804e779a721870bcf7beae3f8e9404b29666a2 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Wed, 5 Oct 2016 18:52:51 +0200 Subject: [PATCH] Fixed toggling of ARIA attributes. --- js/foundation.drilldown.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index 71127b6a8..bcae853fd 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -238,6 +238,12 @@ class Drilldown { e.stopImmediatePropagation(); // console.log('mouseup on back'); _this._hide($elem); + + // If there is a parent submenu, call show + let parentSubMenu = $elem.parent('li').parent('ul').parent('li'); + if (parentSubMenu.length) { + _this._show(parentSubMenu); + } }); } @@ -265,7 +271,8 @@ class Drilldown { * @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag. */ _show($elem) { - $elem.children('[data-submenu]').addClass('is-active'); + $elem.attr('aria-expanded', true); + $elem.children('[data-submenu]').addClass('is-active').attr('aria-hidden', false); /** * Fires when the submenu has opened. * @event Drilldown#open @@ -281,7 +288,8 @@ class Drilldown { */ _hide($elem) { var _this = this; - $elem.addClass('is-closing') + $elem.parent('li').attr('aria-expanded', false); + $elem.attr('aria-hidden', true).addClass('is-closing') .one(Foundation.transitionend($elem), function(){ $elem.removeClass('is-active is-closing'); $elem.blur(); -- 2.47.2