mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 23:27:46 -04:00
fix(settings): do not show admin section container if empty
- fixes https://github.com/nextcloud/server/issues/59337 Already fixed for Nextcloud 34+ but here we need to fix the legacy navigation as well. The problem is that empty `<ul>` elements are not allowed, lists always require at least one list item for accessibility. Ref: https://www.w3.org/TR/wai-aria-1.2/#mustContain Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
127e7fc9bc
commit
d783cab388
1 changed files with 22 additions and 23 deletions
|
|
@ -40,30 +40,29 @@ style('settings', 'settings');
|
|||
|
||||
<?php if (!empty($_['forms']['admin'])): ?>
|
||||
<div id="app-navigation-caption-administration" class="app-navigation-caption"><?php p($l->t('Administration')); ?></div>
|
||||
<nav class="app-navigation-administration" aria-labelledby="app-navigation-caption-administration">
|
||||
<ul>
|
||||
<?php foreach ($_['forms']['admin'] as $form) {
|
||||
if (isset($form['anchor'])) {
|
||||
$anchor = \OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
|
||||
$class = 'nav-icon-' . $form['anchor'];
|
||||
$sectionName = $form['section-name']; ?>
|
||||
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="admin">
|
||||
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
|
||||
<?php if (!empty($form['icon'])) { ?>
|
||||
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
|
||||
<span><?php p($form['section-name']); ?></span>
|
||||
<?php } else { ?>
|
||||
<span class="no-icon"><?php p($form['section-name']); ?></span>
|
||||
<?php } ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<nav class="app-navigation-administration" aria-labelledby="app-navigation-caption-administration">
|
||||
<ul>
|
||||
<?php foreach ($_['forms']['admin'] as $form) {
|
||||
if (isset($form['anchor'])) {
|
||||
$anchor = \OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
|
||||
$class = 'nav-icon-' . $form['anchor'];
|
||||
$sectionName = $form['section-name']; ?>
|
||||
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="admin">
|
||||
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
|
||||
<?php if (!empty($form['icon'])) { ?>
|
||||
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
|
||||
<span><?php p($form['section-name']); ?></span>
|
||||
<?php } else { ?>
|
||||
<span class="no-icon"><?php p($form['section-name']); ?></span>
|
||||
<?php } ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<main id="app-content" <?php if (!empty($_['activeSectionId'])) { ?> data-active-section-id="<?php print_unescaped($_['activeSectionId']) ?>" <?php } if (!empty($_['activeSectionType'])) { ?> data-active-section-type="<?php print_unescaped($_['activeSectionType']) ?>" <?php } ?>>
|
||||
<?php print_unescaped($_['content']); ?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue