]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: remove tree roles from menus
authorJoe Workman <joe@workmanmail.com>
Thu, 26 Aug 2021 16:46:02 +0000 (09:46 -0700)
committerJoe Workman <joe@workmanmail.com>
Thu, 26 Aug 2021 16:46:10 +0000 (09:46 -0700)
closes #12185

js/foundation.accordionMenu.js
js/foundation.drilldown.js
test/javascript/components/drilldown.js

index d24f1837a93da08e232cec2af35fd51dba6e2df0..08368787cb8417b172cba0667797074d10e51ad7 100644 (file)
@@ -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() {
index 236e3baf2f08b2fdc6f6ec08a319df1bd0f39885..c38d9f14ed57615f021094a25e0e9aa8927d4bba 100644 (file)
@@ -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();
           }
         });
       }
index c1c17f46148293ac648e8b402379a9d54ac906a0..a33c77dbc63a5e6b8ac6b461d5f3850333c5ca1f 100644 (file)
@@ -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');
-      });
     });
   });