Skip to content

Commit cd3b1b8

Browse files
authored
[a11y] Table header for articles category list (#40137)
1 parent 674b008 commit cd3b1b8

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

components/com_content/tmpl/category/default_articles.php

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -123,49 +123,47 @@
123123
<caption class="visually-hidden">
124124
<?php echo Text::_('COM_CONTENT_ARTICLES_TABLE_CAPTION'); ?>
125125
</caption>
126-
<?php if ($this->params->get('show_headings')) : ?>
127-
<thead>
128-
<tr>
129-
<th scope="col" id="categorylist_header_title">
130-
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
126+
<thead<?php echo $this->params->get('show_headings', '1') ? '' : ' class="visually-hidden"'; ?>>
127+
<tr>
128+
<th scope="col" id="categorylist_header_title">
129+
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
130+
</th>
131+
<?php if ($date = $this->params->get('list_show_date')) : ?>
132+
<th scope="col" id="categorylist_header_date">
133+
<?php if ($date === 'created') : ?>
134+
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.created', $listDirn, $listOrder); ?>
135+
<?php elseif ($date === 'modified') : ?>
136+
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.modified', $listDirn, $listOrder); ?>
137+
<?php elseif ($date === 'published') : ?>
138+
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.publish_up', $listDirn, $listOrder); ?>
139+
<?php endif; ?>
131140
</th>
132-
<?php if ($date = $this->params->get('list_show_date')) : ?>
133-
<th scope="col" id="categorylist_header_date">
134-
<?php if ($date === 'created') : ?>
135-
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.created', $listDirn, $listOrder); ?>
136-
<?php elseif ($date === 'modified') : ?>
137-
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.modified', $listDirn, $listOrder); ?>
138-
<?php elseif ($date === 'published') : ?>
139-
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.publish_up', $listDirn, $listOrder); ?>
140-
<?php endif; ?>
141-
</th>
142-
<?php endif; ?>
143-
<?php if ($this->params->get('list_show_author')) : ?>
144-
<th scope="col" id="categorylist_header_author">
145-
<?php echo HTMLHelper::_('grid.sort', 'JAUTHOR', 'author', $listDirn, $listOrder); ?>
146-
</th>
147-
<?php endif; ?>
148-
<?php if ($this->params->get('list_show_hits')) : ?>
149-
<th scope="col" id="categorylist_header_hits">
150-
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
151-
</th>
152-
<?php endif; ?>
153-
<?php if ($this->params->get('list_show_votes', 0) && $this->vote) : ?>
154-
<th scope="col" id="categorylist_header_votes">
155-
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_VOTES', 'rating_count', $listDirn, $listOrder); ?>
156-
</th>
157-
<?php endif; ?>
158-
<?php if ($this->params->get('list_show_ratings', 0) && $this->vote) : ?>
159-
<th scope="col" id="categorylist_header_ratings">
160-
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_RATINGS', 'rating', $listDirn, $listOrder); ?>
161-
</th>
162-
<?php endif; ?>
163-
<?php if ($isEditable) : ?>
164-
<th scope="col" id="categorylist_header_edit"><?php echo Text::_('COM_CONTENT_EDIT_ITEM'); ?></th>
165-
<?php endif; ?>
166-
</tr>
167-
</thead>
168-
<?php endif; ?>
141+
<?php endif; ?>
142+
<?php if ($this->params->get('list_show_author')) : ?>
143+
<th scope="col" id="categorylist_header_author">
144+
<?php echo HTMLHelper::_('grid.sort', 'JAUTHOR', 'author', $listDirn, $listOrder); ?>
145+
</th>
146+
<?php endif; ?>
147+
<?php if ($this->params->get('list_show_hits')) : ?>
148+
<th scope="col" id="categorylist_header_hits">
149+
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
150+
</th>
151+
<?php endif; ?>
152+
<?php if ($this->params->get('list_show_votes', 0) && $this->vote) : ?>
153+
<th scope="col" id="categorylist_header_votes">
154+
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_VOTES', 'rating_count', $listDirn, $listOrder); ?>
155+
</th>
156+
<?php endif; ?>
157+
<?php if ($this->params->get('list_show_ratings', 0) && $this->vote) : ?>
158+
<th scope="col" id="categorylist_header_ratings">
159+
<?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_RATINGS', 'rating', $listDirn, $listOrder); ?>
160+
</th>
161+
<?php endif; ?>
162+
<?php if ($isEditable) : ?>
163+
<th scope="col" id="categorylist_header_edit"><?php echo Text::_('COM_CONTENT_EDIT_ITEM'); ?></th>
164+
<?php endif; ?>
165+
</tr>
166+
</thead>
169167
<tbody>
170168
<?php foreach ($this->items as $i => $article) : ?>
171169
<?php if ($this->items[$i]->state == ContentComponent::CONDITION_UNPUBLISHED) : ?>

0 commit comments

Comments
 (0)