Skip to content

Commit 809f448

Browse files
authored
Merge pull request #33746 from nextcloud/a11y/33739/fix-legacy-nav
Add a11y attributes for legacy app navigation
2 parents 23bb4f1 + cc53efe commit 809f448

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

apps/files/js/navigation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@
141141
}
142142
return;
143143
}
144-
this.$el.find('li a').removeClass('active');
144+
this.$el.find('li a').removeClass('active').removeAttr('aria-current');
145145
if (this.$currentContent) {
146146
this.$currentContent.addClass('hidden');
147147
this.$currentContent.trigger(jQuery.Event('hide'));
148148
}
149149
this._activeItem = itemId;
150-
currentItem.children('a').addClass('active');
150+
currentItem.children('a').addClass('active').attr('aria-current', 'page');
151151
this.$currentContent = $('#app-content-' + (typeof itemView === 'string' && itemView !== '' ? itemView : itemId));
152152
this.$currentContent.removeClass('hidden');
153153
if (!options || !options.silent) {

apps/files/templates/appnavigation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="app-navigation">
1+
<div id="app-navigation" role="navigation">
22
<ul class="with-icon">
33

44
<?php

apps/settings/templates/help.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
\OC_Util::addStyle('settings', 'help');
33
?>
4-
<div id="app-navigation">
4+
<div id="app-navigation" role="navigation">
55
<ul>
66
<li>
77
<a class="icon-user <?php if ($_['mode'] === 'user') {
88
p('active');
9-
} ?>"
9+
} ?>" <?php if ($_['mode'] === 'user') { print_unescaped('aria-current="page"'); } ?>
1010
href="<?php print_unescaped($_['urlUserDocs']); ?>">
1111
<span class="help-list__text">
1212
<?php p($l->t('User documentation')); ?>
@@ -17,7 +17,7 @@
1717
<li>
1818
<a class="icon-user-admin <?php if ($_['mode'] === 'admin') {
1919
p('active');
20-
} ?>"
20+
} ?>" <?php if ($_['mode'] === 'admin') { print_unescaped('aria-current="page"'); } ?>
2121
href="<?php print_unescaped($_['urlAdminDocs']); ?>">
2222
<span class="help-list__text">
2323
<?php p($l->t('Administrator documentation')); ?>

apps/settings/templates/settings/frame.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
?>
3131

32-
<div id="app-navigation">
32+
<div id="app-navigation" role="navigation">
3333
<ul>
3434
<?php if (!empty($_['forms']['admin'])) { ?>
3535
<li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li>
@@ -39,10 +39,9 @@
3939
if (isset($form['anchor'])) {
4040
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
4141
$class = 'nav-icon-' . $form['anchor'];
42-
$sectionName = $form['section-name'];
43-
$active = $form['active'] ? ' class="active"' : ''; ?>
42+
$sectionName = $form['section-name']; ?>
4443
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
45-
<a href="<?php p($anchor); ?>">
44+
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
4645
<?php if (!empty($form['icon'])) { ?>
4746
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
4847
<span><?php p($form['section-name']); ?></span>
@@ -66,10 +65,9 @@
6665
if (isset($form['anchor'])) {
6766
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
6867
$class = 'nav-icon-' . $form['anchor'];
69-
$sectionName = $form['section-name'];
70-
$active = $form['active'] ? ' class="active"' : ''; ?>
68+
$sectionName = $form['section-name']; ?>
7169
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
72-
<a href="<?php p($anchor); ?>">
70+
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
7371
<?php if (!empty($form['icon'])) { ?>
7472
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
7573
<span><?php p($form['section-name']); ?></span>

0 commit comments

Comments
 (0)