Improved a11y of box menus
authorMarcel Werk <burntime@woltlab.com>
Fri, 3 Aug 2018 11:07:15 +0000 (13:07 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 3 Aug 2018 11:07:15 +0000 (13:07 +0200)
See #2713

com.woltlab.wcf/templates/__menu.tpl
wcfsetup/install/files/lib/data/menu/Menu.class.php

index 0520f3ea1153f8598a3c56367cfc674f99000f78..b44574f2090d02b94cecca6c5f1fb345dff80e83 100644 (file)
@@ -1,10 +1,10 @@
-<nav>
+<nav aria-label="{$menuTitle}">
        <ol class="boxMenu">
                {event name='menuBefore'}
                
                {foreach from=$menuItemNodeList item=menuItemNode}
                        <li class="{if $menuItemNode->isActiveNode()}active{/if}{if $menuItemNode->hasChildren()} boxMenuHasChildren{/if}" data-identifier="{@$menuItemNode->identifier}">
-                               <a href="{$menuItemNode->getURL()}" class="boxMenuLink"{if $menuItemNode->isExternalLink()}{if EXTERNAL_LINK_REL_NOFOLLOW} rel="nofollow"{/if}{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}{/if}>
+                               <a href="{$menuItemNode->getURL()}" class="boxMenuLink"{if $menuItemNode->isExternalLink()}{if EXTERNAL_LINK_REL_NOFOLLOW} rel="nofollow"{/if}{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}{/if}{if $menuItemNode->isActiveNode()} aria-current="page"{/if}>
                                        <span class="boxMenuLinkTitle">{lang}{$menuItemNode->title}{/lang}</span>
                                        {if $menuItemNode->getOutstandingItems() > 0}
                                                <span class="boxMenuLinkOutstandingItems badge badgeUpdate">{#$menuItemNode->getOutstandingItems()}</span>
index e182d28699965e0d30db6a14854b4c967f445678..05a8229a3532e23802dcbd6d5204dc9cdcf83931 100644 (file)
@@ -79,7 +79,10 @@ class Menu extends DatabaseObject {
         * @return      string
         */
        public function getContent() {
-               WCF::getTPL()->assign(['menuItemNodeList' => $this->getMenuItemNodeList()]);
+               WCF::getTPL()->assign([
+                       'menuItemNodeList' => $this->getMenuItemNodeList(),
+                       'menuTitle' => $this->getTitle()
+               ]);
                return WCF::getTPL()->fetch('__menu');
        }