diff --git a/app/controllers/start.php b/app/controllers/start.php index 53a87dc796ad92cfd51f6191e87d72d14e48795a..eefc3f6fd9d019fc6c9fbbcfcd80c06225cf66f9 100644 --- a/app/controllers/start.php +++ b/app/controllers/start.php @@ -57,6 +57,7 @@ class StartController extends AuthenticatedController $nav = $sidebar->addWidget(new NavigationWidget()); $nav->setTitle(_('Sprungmarken')); + $nav->setId('navigation-layer-3'); foreach (array_merge(...$this->columns) as $widget) { $nav->addLink( $widget->getPluginName(), diff --git a/lib/classes/sidebar/Sidebar.php b/lib/classes/sidebar/Sidebar.php index a6e5ec0b114a2ef542a862206a084f97d99af6ff..b9d0338c2db7938406932901fb9ee80bdd3808c6 100644 --- a/lib/classes/sidebar/Sidebar.php +++ b/lib/classes/sidebar/Sidebar.php @@ -222,7 +222,7 @@ class Sidebar extends WidgetContainer static $actions_widget_added = false; - if ($widget instanceof NavigationWidget && !$navigation_widget_added) { + if ($widget instanceof NavigationWidget && !$navigation_widget_added && $widget->hasElements()) { SkipLinks::addIndex( _('Dritte Navigationsebene'), $widget->getId(), @@ -233,7 +233,7 @@ class Sidebar extends WidgetContainer $navigation_widget_added = true; } - if ($widget instanceof ActionsWidget && !$actions_widget_added) { + if ($widget instanceof ActionsWidget && !$actions_widget_added && $widget->hasElements()) { if (!$widget->getId()) { $widget->setId('sidebar-actions'); } diff --git a/templates/header.php b/templates/header.php index c677de01d5d92bf2a627c76fa368f73a0d2de952..6ed0158a2a1ef15b7722cea8079b6c495bfe3bb2 100644 --- a/templates/header.php +++ b/templates/header.php @@ -216,7 +216,9 @@ if ($navigation) { <!-- Main navigation and right-hand logo --> <nav id="navigation-level-1" aria-label="<?= _('Hauptnavigation') ?>"> - <? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false); ?> + <? if (!empty($header_nav['visible'])) : ?> + <? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false) ?> + <? endif ?> <ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>> <? foreach ($header_nav['visible'] as $path => $nav): ?> <?= $this->render_partial( @@ -297,10 +299,12 @@ if ($navigation) { </div> <? endif ?> - <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?> <nav id="navigation-level-2" aria-label="<?= _('Zweite Navigationsebene') ?>"> <? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?> + <? if (!empty($navigation)) : ?> + <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?> + <? endif ?> <?= $this->render_partial('tabs', compact('navigation')) ?> <? endif; ?> </nav> diff --git a/templates/tabs.php b/templates/tabs.php index 987e0fd1b1620fe1daa9e4c7f9015d2daf84af9d..24597cb4e95e7df5db53ca7913dc0a1c7340871b 100644 --- a/templates/tabs.php +++ b/templates/tabs.php @@ -7,10 +7,10 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) { } ?> <div class="tabs_wrapper"> - <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?> <ul id="tabs"> <? if (!empty($navigation)): ?> - <? foreach ($navigation as $path => $nav) : ?> + <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?> + <? foreach ($navigation as $path => $nav) : ?> <? if ($nav->isVisible()) : ?> <li id="nav_<?= $path1 ?? '' ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>> <? if ($nav->isEnabled()): ?>