]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: do not overwrite aria-label if one is present
authorJoe Workman <joe@workmanmail.com>
Mon, 11 Jul 2022 23:32:26 +0000 (16:32 -0700)
committerJoe Workman <joe@workmanmail.com>
Mon, 11 Jul 2022 23:32:26 +0000 (16:32 -0700)
closes #12447

js/foundation.util.nest.js

index a5d468b723ae687335c78437c2ce04f06ac7417c..d2955f9943471f6cf0bb98a1ea094a8ec788df56 100644 (file)
@@ -18,9 +18,10 @@ const Nest = {
       if ($sub.length) {
         $item.addClass(hasSubClass);
         if(applyAria) {
-          $item.children('a:first').attr({
+          const firstItem = $item.children('a:first');
+          firstItem.attr({
             'aria-haspopup': true,
-            'aria-label': $item.children('a:first').text()
+            'aria-label': firstItem.attr('aria-label') || firstItem.text()
           });
           // Note:  Drilldowns behave differently in how they hide, and so need
           // additional attributes.  We should look if this possibly over-generalized