Skip to content

Commit f024bbd

Browse files
Nicholas J. Kisseberthclaude
andcommitted
[a11y] Fix project plugins — empty headers, alt text, labels, fieldsets, null guards
- Add aria-label/sr-only text to empty <th> elements across team, files, publications, todo - Add alt text to activity feed profile images and comment author images - Add aria-label to project nav <select> in JS - Add aria-label to team tables and checkbox inputs - Replace wrapping <fieldset> with <div> for pagination (no form semantics needed) - Remove .mini class from team view to prevent small-text compounding - Guard against null activity log and missing creator in feed rendering - Add sr-only text to empty icon-only links in publications row Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa71427 commit f024bbd

13 files changed

Lines changed: 41 additions & 27 deletions

File tree

core/components/com_projects/site/assets/js/projects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ jQuery(document).ready(function($){
388388
if (el.length) {
389389
el.addClass('jsm');
390390

391-
var select = $("<select />").on('change', function() {
391+
var select = $("<select />", {"aria-label": "Project navigation"}).on('change', function() {
392392
window.location = $(this).find("option:selected").val();
393393
});
394394

core/plugins/projects/feed/views/activity/tmpl/_activity.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
// No direct access
99
defined('_HZEXEC_') or die();
1010

11+
// Skip rendering if the activity log is missing
12+
if (!$this->activity->log || !$this->activity->log->get('id'))
13+
{
14+
return;
15+
}
16+
1117
$class = $this->activity->log->details->get('class', 'activity');
1218
$commentable = (!$this->activity->log->get('parent'));
1319
$deletable = $this->model->access('manager');
@@ -16,6 +22,12 @@
1622

1723
$creator = User::getInstance($this->activity->log->get('created_by'));
1824

25+
// Skip rendering if both the creator and description are missing
26+
if (!$creator->get('id') && !trim($this->activity->log->get('description')))
27+
{
28+
return;
29+
}
30+
1931
$new = false;
2032
if ($this->model->member())
2133
{
@@ -25,6 +37,7 @@
2537
$recorded = $this->activity->get('created');
2638

2739
$name = Lang::txt('JANONYMOUS');
40+
$nameText = $name;
2841

2942
$online = false;
3043

@@ -33,6 +46,7 @@
3346
{
3447
// Get their full name
3548
$name = $this->escape(stripslashes($creator->get('name', Lang::txt('PLG_PROJECTS_ACTIVITY_UNKNOWN'))));
49+
$nameText = $name;
3650

3751
// Can we see their profile?
3852
if (in_array($creator->get('access'), User::getAuthorisedViewLevels()))
@@ -51,14 +65,14 @@
5165
<div class="activity-actor-picture<?php if ($online) { echo ' tooltips" title="' . Lang::txt('PLG_PROJECTS_FEED_ONLINE'); } ?>">
5266
<?php if ($showProject) { ?>
5367
<span class="user-img-wrap">
54-
<img class="project-image" src="<?php echo Route::url($this->model->link('thumb')); ?>" alt="" />
68+
<img class="project-image" src="<?php echo Route::url($this->model->link('thumb')); ?>" alt="<?php echo $this->escape($this->model->get('title')); ?>" />
5569
<?php if ($online) { ?>
5670
<span class="online"><?php echo Lang::txt('PLG_PROJECTS_FEED_ONLINE'); ?></span>
5771
<?php } ?>
5872
</span>
5973
<?php } else { ?>
6074
<a class="user-img-wrap" href="<?php echo Route::url($creator->link()); ?>">
61-
<img src="<?php echo $creator->picture(); ?>" alt="" />
75+
<img src="<?php echo $creator->picture(); ?>" alt="<?php echo $nameText; ?>" />
6276
<?php if ($online) { ?>
6377
<span class="online"><?php echo Lang::txt('PLG_PROJECTS_FEED_ONLINE'); ?></span>
6478
<?php } ?>

core/plugins/projects/feed/views/activity/tmpl/_comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
<div class="activity-actor-picture<?php if ($online) { echo ' tooltips" title="' . Lang::txt('PLG_PROJECTS_FEED_ONLINE'); } ?>">
4949
<span class="user-img-wrap">
50-
<img class="comment-author" src="<?php echo $creator->picture($comment->admin); ?>" alt="" />
50+
<img class="comment-author" src="<?php echo $creator->picture($comment->admin); ?>" alt="<?php echo $this->escape(($comment->admin == 1) ? Lang::txt('COM_PROJECTS_ADMIN') : $comment->author); ?>" />
5151
<?php if ($online) { ?>
5252
<span class="online"><?php echo Lang::txt('PLG_PROJECTS_FEED_ONLINE'); ?></span>
5353
<?php } ?>

core/plugins/projects/files/views/browse/tmpl/display.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<a href="<?php echo Route::url($this->model->link('files') . '&action=browse' . $subdirlink . '&sortby=name&sortdir=' . $sortbyDir); ?>" class="re_sort" title="<?php echo Lang::txt('PLG_PROJECTS_FILES_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_FILES_NAME'); ?>">
130130
<?php echo Lang::txt('PLG_PROJECTS_FILES_NAME'); ?></a>
131131
</th>
132-
<th class="centeralign"></th>
132+
<th class="centeralign" aria-label="<?php echo Lang::txt('Type'); ?>"><span class="sr-only">Type</span></th>
133133
<th <?php if ($this->params['sortby'] == 'size') { echo 'class="activesort"'; } ?>>
134134
<a href="<?php echo Route::url($this->model->link('files') . '&action=browse' . $subdirlink . '&sortby=size&sortdir=' . $sortbyDir); ?>" class="re_sort" title="<?php echo Lang::txt('PLG_PROJECTS_FILES_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_FILES_SIZE'); ?>"><?php echo Lang::txt('PLG_PROJECTS_FILES_SIZE'); ?></a>
135135
</th>
@@ -139,7 +139,7 @@
139139
<?php if ($this->repo->getAdapterName() == 'git'){ ?>
140140
<th><?php echo ucfirst(Lang::txt('PLG_PROJECTS_FILES_BY')); ?></th>
141141
<?php }; ?>
142-
<th class="centeralign nojs"></th>
142+
<th class="centeralign nojs" aria-label="<?php echo Lang::txt('Options'); ?>"><span class="sr-only">Options</span></th>
143143
<?php if ($this->publishing) { ?>
144144
<th><?php echo Lang::txt('PLG_PROJECTS_FILES_PUBLISHED'); ?></th>
145145
<?php } ?>

core/plugins/projects/files/views/connected/tmpl/browse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class="re_sort" title="<?php echo Lang::txt('PLG_PROJECTS_FILES_SORT_BY') . ' '
107107
<?php echo Lang::txt('PLG_PROJECTS_FILES_NAME'); ?>
108108
</a>
109109
</th>
110-
<th class="centeralign"></th>
110+
<th class="centeralign" aria-label="<?php echo Lang::txt('Type'); ?>"><span class="sr-only">Type</span></th>
111111
<th <?php if ($this->sortby == 'size') { echo 'class="activesort"'; } ?>>
112112
<a href="<?php echo Route::url($this->model->link('files') . '&connection=' . $this->connection->id . '&action=browse' . $subdirlink . '&sortby=size&sortdir=' . $sortbyDir); ?>"
113113
class="re_sort" title="<?php echo Lang::txt('PLG_PROJECTS_FILES_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_FILES_SIZE'); ?>">
@@ -121,7 +121,7 @@ class="re_sort" title="<?php echo Lang::txt('PLG_PROJECTS_FILES_SORT_BY') . ' '
121121
</a>
122122
</th>
123123
<th><?php echo ucfirst(Lang::txt('PLG_PROJECTS_FILES_BY')); ?></th>
124-
<th class="centeralign nojs"></th>
124+
<th class="centeralign nojs" aria-label="<?php echo Lang::txt('Options'); ?>"><span class="sr-only">Options</span></th>
125125
</tr>
126126
</thead>
127127
<tbody>

core/plugins/projects/publications/views/browse/tmpl/_row.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
<td class="centeralign mini faded"><?php if ($row->versions > 0) { ?><a href="<?php echo Route::url($this->project->link('publications') . '&pid=' . $row->get('id') . '&action=versions'); ?>" title="<?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_VIEW_VERSIONS'); ?>"><?php } ?><?php echo $row->get('versions'); ?><?php if ($row->get('versions') > 0) { ?></a><?php } ?></td>
6565
<td class="autowidth">
66-
<a href="<?php echo Route::url($this->project->link('publications') . '&pid=' . $row->get('id')); ?>" class="manageit" title="<?php echo ucfirst(Lang::txt('PLG_PROJECTS_PUBLICATIONS_MANAGE_VERSION')); ?>">&nbsp;</a>
66+
<a href="<?php echo Route::url($this->project->link('publications') . '&pid=' . $row->get('id')); ?>" class="manageit" title="<?php echo ucfirst(Lang::txt('PLG_PROJECTS_PUBLICATIONS_MANAGE_VERSION')); ?>"><span class="sr-only"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_PUBLICATIONS_MANAGE_VERSION')); ?></span></a>
6767

68-
<a href="<?php echo Route::url('index.php?option=com_publications&id=' . $row->get('id') . '&v=' . $row->get('version_number')); ?>" class="public-page" title="<?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_VIEW_PUB_PAGE'); ?>">&nbsp;</a></td>
68+
<a href="<?php echo Route::url('index.php?option=com_publications&id=' . $row->get('id') . '&v=' . $row->get('version_number')); ?>" class="public-page" title="<?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_VIEW_PUB_PAGE'); ?>"><span class="sr-only"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_VIEW_PUB_PAGE'); ?></span></a></td>
6969
</tr>

core/plugins/projects/publications/views/browse/tmpl/default.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
<table id="filelist" class="listing">
6969
<thead>
7070
<tr>
71-
<th></th>
71+
<th aria-label="<?php echo Lang::txt('Image'); ?>"><span class="sr-only">Image</span></th>
7272
<th class="thtype<?php if ($this->filters['sortby'] == 'title') { echo ' activesort'; } ?>"><a href="<?php echo Route::url($this->project->link('publications') . $sortAppend . '&sortby=title'); ?>" class="re_sort" title="<?php echo Lang::txt('COM_PROJECTS_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_TITLE'); ?>"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_TITLE'); ?></a></th>
7373
<th class="thtype<?php if ($this->filters['sortby'] == 'id') { echo ' activesort'; } ?>"><a href="<?php echo Route::url($this->project->link('publications') . $sortAppend . '&sortby=id'); ?>" class="re_sort" title="<?php echo Lang::txt('COM_PROJECTS_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_ID'); ?>"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_ID'); ?></a></th>
7474
<th class="thtype<?php if ($this->filters['sortby'] == 'type') { echo ' activesort'; } ?>"><a href="<?php echo Route::url($this->project->link('publications') . $sortAppend . '&sortby=type'); ?>" class="re_sort" title="<?php echo Lang::txt('COM_PROJECTS_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_TYPE'); ?>"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_CONTENT_TYPE'); ?></a></th>
7575
<th<?php if ($this->filters['sortby'] == 'status') { echo ' class="activesort"'; } ?> colspan="2"><a href="<?php echo Route::url($this->project->link('publications') . $sortAppend . '&sortby=status'); ?>" class="re_sort" title="<?php echo Lang::txt('COM_PROJECTS_SORT_BY') . ' ' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_STATUS'); ?>"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_STATUS'); ?></a></th>
7676
<th class="condensed centeralign"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_RELEASES'); ?></th>
77-
<th></th>
77+
<th aria-label="<?php echo Lang::txt('Actions'); ?>"><span class="sr-only">Actions</span></th>
7878
</tr>
7979
</thead>
8080
<tbody>
@@ -109,11 +109,11 @@
109109

110110
$pagenavhtml = $pageNav->render();
111111
?>
112-
<fieldset>
112+
<div>
113113
<input type="hidden" name="sortby" value="<?php echo $this->escape($this->filters['sortby']); ?>" />
114114
<input type="hidden" name="sortdir" value="<?php echo $this->escape($this->filters['sortdir']); ?>" />
115115
<?php echo $pagenavhtml; ?>
116-
</fieldset>
116+
</div>
117117
</form>
118118
</div>
119119
<?php

core/plugins/projects/publications/views/versions/tmpl/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<table class="listing">
2929
<thead>
3030
<tr>
31-
<th class="tdmini"></th>
31+
<th class="tdmini" aria-label="#">#</th>
3232
<th class="tdmini"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_VERSION'); ?></th>
3333
<th><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_TITLE'); ?></th>
3434
<th><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_STATUS'); ?></th>

core/plugins/projects/team/views/edit/tmpl/choose.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<table id="teamlist" class="listing">
3737
<thead>
3838
<tr>
39-
<th class="checkbox"></th>
40-
<th class="th_image"></th>
39+
<th class="checkbox" aria-label="<?php echo Lang::txt('Select'); ?>"><span class="sr-only">Select</span></th>
40+
<th class="th_image" aria-label="<?php echo Lang::txt('Photo'); ?>"><span class="sr-only">Photo</span></th>
4141
<th class="th_user i_user activesort">
4242
<?php echo Lang::txt('PLG_PROJECTS_TEAM_NAME'); ?>
4343
</th>

core/plugins/projects/team/views/edit/tmpl/default.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
<table id="teamlist" class="listing">
161161
<thead>
162162
<tr>
163-
<th class="checkbox"></th>
164-
<th class="th_image"></th>
163+
<th class="checkbox" aria-label="<?php echo Lang::txt('Select'); ?>"><span class="sr-only">Select</span></th>
164+
<th class="th_image" aria-label="<?php echo Lang::txt('Photo'); ?>"><span class="sr-only">Photo</span></th>
165165
<th class="th_user i_user <?php if ($this->filters['sortby'] == 'name') { echo 'activesort'; } ?>">
166166
<a class="re_sort" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=' . $this->task . '&alias=' . $this->model->get('alias') . '&active=team&sortby=name&sortdir=' . $sortbyDir); ?>">
167167
<?php echo Lang::txt('PLG_PROJECTS_TEAM_NAME'); ?>

0 commit comments

Comments
 (0)