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 ...@@ -399,7 +399,13 @@ class Navigation implements IteratorAggregate
*/ */
public function getLinkAttributes() 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) { ...@@ -210,7 +210,7 @@ if ($navigation) {
<!-- End top bar --> <!-- End top bar -->
<!-- Main navigation and right-hand logo --> <!-- 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); ?> <? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false); ?>
<ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>> <ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>>
<? foreach ($header_nav['visible'] as $path => $nav): ?> <? foreach ($header_nav['visible'] as $path => $nav): ?>
...@@ -289,7 +289,7 @@ if ($navigation) { ...@@ -289,7 +289,7 @@ if ($navigation) {
<? endif ?> <? endif ?>
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?> <? 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)*/) : ?> <? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?>
<?= $this->render_partial('tabs', compact('navigation')) ?> <?= $this->render_partial('tabs', compact('navigation')) ?>
......
...@@ -24,7 +24,7 @@ if ($bg_mobile) { ...@@ -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-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> <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> <header>
<h1><?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?></h1> <h1><?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?></h1>
</header> </header>
......
...@@ -5,7 +5,6 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) { ...@@ -5,7 +5,6 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) {
$path1 = $path; $path1 = $path;
} }
} }
$ebene3 = [];
?> ?>
<div class="tabs_wrapper"> <div class="tabs_wrapper">
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?> <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?>
...@@ -14,7 +13,6 @@ $ebene3 = []; ...@@ -14,7 +13,6 @@ $ebene3 = [];
<? foreach ($navigation as $path => $nav) : ?> <? foreach ($navigation as $path => $nav) : ?>
<? if ($nav->isVisible()) : ?> <? if ($nav->isVisible()) : ?>
<li id="nav_<?= $path1 ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>> <li id="nav_<?= $path1 ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>>
<? if ($nav->isActive()) $path2 = $path; ?>
<? if ($nav->isEnabled()): ?> <? if ($nav->isEnabled()): ?>
<? <?
$attr = array_merge(['class' => ''], $nav->getLinkAttributes()); $attr = array_merge(['class' => ''], $nav->getLinkAttributes());
...@@ -27,26 +25,8 @@ $ebene3 = []; ...@@ -27,26 +25,8 @@ $ebene3 = [];
<? if ($image = $nav->getImage()) : ?> <? if ($image = $nav->getImage()) : ?>
<?= $image->asImg(['class' => "tab-icon", 'title' => $nav->getTitle() ? $nav->getTitle() : $nav->getDescription()]) ?> <?= $image->asImg(['class' => "tab-icon", 'title' => $nav->getTitle() ? $nav->getTitle() : $nav->getDescription()]) ?>
<? endif ?> <? 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> </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: ?> <? else: ?>
<span class="quiet tab-title"> <span class="quiet tab-title">
<? if ($image = $nav->getImage()) : ?> <? 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