Skip to content
Snippets Groups Projects
Commit 1e8bc6cb authored by Elmar Ludwig's avatar Elmar Ludwig Committed by Moritz Strohm
Browse files

use aria-current="page" correctly, closes #1748

Closes #1748

Merge request studip/studip!1338
parent 5f99851e
No related branches found
No related tags found
No related merge requests found
......@@ -399,7 +399,13 @@ class Navigation implements IteratorAggregate
*/
public function getLinkAttributes()
{
return $this->link_attributes;
$attributes = $this->link_attributes;
if ($this->isActive()) {
$attributes['aria-current'] = 'page';
}
return $attributes;
}
/**
......
......@@ -210,7 +210,7 @@ if ($navigation) {
<!-- End top bar -->
<!-- Main navigation and right-hand logo -->
<nav id="navigation-level-1" aria-current="page" aria-label="<?= _('Hauptnavigation') ?>">
<nav id="navigation-level-1" aria-label="<?= _('Hauptnavigation') ?>">
<? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false); ?>
<ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>>
<? foreach ($header_nav['visible'] as $path => $nav): ?>
......@@ -289,7 +289,7 @@ if ($navigation) {
<? endif ?>
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?>
<nav id="navigation-level-2" aria-current="page" aria-label="<?= _('Zweite Navigationsebene') ?>">
<nav id="navigation-level-2" aria-label="<?= _('Zweite Navigationsebene') ?>">
<? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?>
<?= $this->render_partial('tabs', compact('navigation')) ?>
......
......@@ -24,7 +24,7 @@ if ($bg_mobile) {
<div id="background-desktop" style="background: url(<?= $bg_desktop ?>) no-repeat top left/cover;"></div>
<div id="background-mobile" style="background: url(<?= $bg_mobile ?>) no-repeat top left/cover;"></div>
<article id="loginbox" aria-current="page">
<article id="loginbox">
<header>
<h1><?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?></h1>
</header>
......
......@@ -5,7 +5,6 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) {
$path1 = $path;
}
}
$ebene3 = [];
?>
<div class="tabs_wrapper">
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?>
......@@ -14,7 +13,6 @@ $ebene3 = [];
<? foreach ($navigation as $path => $nav) : ?>
<? if ($nav->isVisible()) : ?>
<li id="nav_<?= $path1 ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>>
<? if ($nav->isActive()) $path2 = $path; ?>
<? if ($nav->isEnabled()): ?>
<?
$attr = array_merge(['class' => ''], $nav->getLinkAttributes());
......@@ -27,26 +25,8 @@ $ebene3 = [];
<? if ($image = $nav->getImage()) : ?>
<?= $image->asImg(['class' => "tab-icon", 'title' => $nav->getTitle() ? $nav->getTitle() : $nav->getDescription()]) ?>
<? endif ?>
<span title="<?= $nav->getDescription() ? htmlReady($nav->getDescription()) : htmlReady($nav->getTitle())?>" class="tab-title"><?= $nav->getTitle() ? htmlReady($nav->getTitle()) : '&nbsp;' ?></span>
<span title="<?= $nav->getDescription() ? htmlReady($nav->getDescription()) : htmlReady($nav->getTitle())?>" class="tab-title"><?= htmlReady($nav->getTitle()) ?></span>
</a>
<? if (count($nav->getSubNavigation()) > 1): ?>
<?
if ($nav->isActive()) {
foreach ($nav->getSubNavigation() as $subnav) {
$ebene3[$subnav->getURL()] = $subnav;
}
}
/*$content_group = ContentGroupMenu::get();
$content_group->setLabel("");
$content_group->setIcon(Icon::create('arr_1down', 'clickable', array()));
foreach ($nav->getSubNavigation() as $subnav) {
$content_group->addLink(URLHelper::getLink($subnav->getURL()), _($subnav->getTitle()), $subnav->getImage());
}*/
?>
<?//= $content_group->render(); ?>
<? endif; ?>
<? else: ?>
<span class="quiet tab-title">
<? if ($image = $nav->getImage()) : ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment