Skip to content

Commit cd44cfd

Browse files
committed
fix(settings): do not show admin section container if empty
- fixes #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>
1 parent 127e7fc commit cd44cfd

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

apps/settings/templates/settings/frame.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,30 @@
4040

4141
<?php if (!empty($_['forms']['admin'])): ?>
4242
<div id="app-navigation-caption-administration" class="app-navigation-caption"><?php p($l->t('Administration')); ?></div>
43-
<?php endif; ?>
44-
<nav class="app-navigation-administration" aria-labelledby="app-navigation-caption-administration">
45-
<ul>
46-
<?php foreach ($_['forms']['admin'] as $form) {
47-
if (isset($form['anchor'])) {
48-
$anchor = \OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
49-
$class = 'nav-icon-' . $form['anchor'];
50-
$sectionName = $form['section-name']; ?>
51-
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="admin">
52-
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
53-
<?php if (!empty($form['icon'])) { ?>
54-
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
55-
<span><?php p($form['section-name']); ?></span>
56-
<?php } else { ?>
57-
<span class="no-icon"><?php p($form['section-name']); ?></span>
58-
<?php } ?>
59-
</a>
60-
</li>
61-
<?php
43+
<nav class="app-navigation-administration" aria-labelledby="app-navigation-caption-administration">
44+
<ul>
45+
<?php foreach ($_['forms']['admin'] as $form) {
46+
if (isset($form['anchor'])) {
47+
$anchor = \OCP\Server::get(\OCP\IURLGenerator::class)->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
48+
$class = 'nav-icon-' . $form['anchor'];
49+
$sectionName = $form['section-name']; ?>
50+
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="admin">
51+
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
52+
<?php if (!empty($form['icon'])) { ?>
53+
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
54+
<span><?php p($form['section-name']); ?></span>
55+
<?php } else { ?>
56+
<span class="no-icon"><?php p($form['section-name']); ?></span>
57+
<?php } ?>
58+
</a>
59+
</li>
60+
<?php
61+
}
6262
}
63-
}
64-
?>
65-
</ul>
66-
</nav>
63+
?>
64+
</ul>
65+
</nav>
66+
<?php endif; ?>
6767
</div>
6868
<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 } ?>>
6969
<?php print_unescaped($_['content']); ?>

0 commit comments

Comments
 (0)