From: Joe Workman Date: Thu, 26 Aug 2021 16:46:02 +0000 (-0700) Subject: fix: remove tree roles from menus X-Git-Tag: v6.7.1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93484561ef03e3bc2fd6d6d63a4fc3eca0c95f6c;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: remove tree roles from menus closes #12185 --- diff --git a/js/foundation.accordionMenu.js b/js/foundation.accordionMenu.js index d24f1837a..08368787c 100644 --- a/js/foundation.accordionMenu.js +++ b/js/foundation.accordionMenu.js @@ -54,7 +54,6 @@ class AccordionMenu extends Plugin { this.$element.find('[data-submenu]').not('.is-active').slideUp(0);//.find('a').css('padding-left', '1rem'); this.$element.attr({ - 'role': 'tree', 'aria-multiselectable': this.options.multiOpen }); @@ -88,9 +87,6 @@ class AccordionMenu extends Plugin { 'id': subId }); }); - this.$element.find('li').attr({ - 'role': 'treeitem' - }); var initPanes = this.$element.find('.is-active'); if (initPanes.length) { initPanes.each(function() { diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index 236e3baf2..c38d9f14e 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -55,12 +55,11 @@ class Drilldown extends Plugin { } this.$element.attr({ - 'role': 'tree', 'aria-multiselectable': false }); this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a'); this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]').attr('role', 'group'); - this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'treeitem').find('a'); + this.$menuItems = this.$element.find('li').not('.js-drilldown-back').find('a'); // Set the main menu as current by default (unless a submenu is selected) // Used to set the wrapper height when the drilldown is closed/reopened from any (sub)menu @@ -415,7 +414,7 @@ class Drilldown extends Plugin { // If target menu is root, focus first link & exit if ($elem.is('[data-drilldown]')) { - if (autoFocus === true) $elem.find('li[role="treeitem"] > a').first().focus(); + if (autoFocus === true) $elem.find('li > a').first().focus(); if (this.options.autoHeight) this.$wrapper.css('height', $elem.data('calcHeight')); return; } @@ -438,7 +437,7 @@ class Drilldown extends Plugin { if (isLastChild === true) { $(this).one(transitionend($(this)), () => { if (autoFocus === true) { - $elem.find('li[role="treeitem"] > a').first().focus(); + $elem.find('li > a').first().focus(); } }); } diff --git a/test/javascript/components/drilldown.js b/test/javascript/components/drilldown.js index c1c17f461..a33c77dbc 100644 --- a/test/javascript/components/drilldown.js +++ b/test/javascript/components/drilldown.js @@ -71,8 +71,6 @@ describe('Drilldown Menu', function() { $html = $(template).appendTo('body'); plugin = new Foundation.Drilldown($html, {}); - plugin.$element.should.have.attr('role', 'tree'); - plugin.$element.find('[data-submenu]').each(function() { $(this).should.have.attr('role', 'group'); $(this).should.have.attr('aria-hidden', 'true'); @@ -84,9 +82,6 @@ describe('Drilldown Menu', function() { $(this).should.have.attr('aria-label', $(this).children('a').first().text()); }); - plugin.$element.find('li:not(.js-drilldown-back)').each(function() { - $(this).should.have.attr('role', 'treeitem'); - }); }); });