Skip to content

Commit 0fb42e0

Browse files
susnuxbackportbot[bot]
authored andcommitted
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 111f803 commit 0fb42e0

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

apps/settings/templates/settings/frame.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,29 @@
3737

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

0 commit comments

Comments
 (0)