Protostar pagination update#18326
Conversation
Improve thew accessibility of the pagination 1. Wrap the pagination in a nav and add a role (needed for IE) and an aria-label 2. Ensure font icons have aria-hidden=true 3. Add aria-current to the selected page 4. Add aria-title to the active links eg Go to page 1 ### Note 1 that the disabled links will not be announced to a screen reader which is the intended behaviour Note that the list is an unordered list which appears to be the standard as otherwise the links would be announced as Link 1 go to page 2 etc which is nonsense ### Note 2 I dont know why but protostar uses an override for pagination instead of the layout. For b/c this PR is just for the override but when approved I will do a similar Pr for the layout Thanks to @fuzzbomb (Drupal 8 Core Accessibility Maintainer) for reviewing this
| } | ||
|
|
||
| $html = '<ul class="pagination-list">'; | ||
| $html = '<nav role="navigation" aria-label="' . JText::_('JPAGINATION') . '">'; |
There was a problem hiding this comment.
JPAGINATION... is that correct? Can't find this constant anywhere.
There was a problem hiding this comment.
Should be JLIB_HTML_PAGINATION
| if ($item->text === JText::_('JNEXT')) | ||
| { | ||
| $display = '<span class="icon-next"></span>'; | ||
| $display = '<span class="icon-next" aria-hidden="true" ></span>'; |
|
I have tested this item ✅ successfully on 08d0638 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18326. |
|
I would prefer it to say |
|
@Quy I agree - the sprintf for the page number is easy - will need a little code change for the prev,next strings - i will look at it on sunday |
|
@Quy I have had a go at the sprintf stuff - it works but maybe you can optimise it and make it DRY |
| if (isset($item->active) && $item->active) | ||
| { | ||
| return '<li class="active hidden-phone"><a>' . $item->text . '</a></li>'; | ||
| return '<li class="active hidden-phone"><a aria-current="true" aria-label="' . JText::_('JLIB_HTML_PAGE') . ' ' . $item->text . '">' . $item->text . '</a></li>'; |
There was a problem hiding this comment.
sprintf here? JText::_('JLIB_HTML_PAGE') . ' ' . $item->text
|
Looks good!
|
|
Changing to previous will have to wait until this is approved and I can work n the pagination layout as well |
| JLIB_HTML_MOVE_UP="Move Up" | ||
| JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM="There are no parameters for this item." | ||
| JLIB_HTML_NO_RECORDS_FOUND="No records found." | ||
| JLIB_HTML_PAGE="Page" |
There was a problem hiding this comment.
No - we dont delete strings ;)
There was a problem hiding this comment.
ah whoops it was me that added it
language/en-GB/en-GB.lib_joomla.ini
Outdated
| JLIB_HTML_MOVE_UP="Move Up" | ||
| JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM="There are no parameters for this item." | ||
| JLIB_HTML_NO_RECORDS_FOUND="No records found." | ||
| JLIB_HTML_PAGE="Page" |
| if (isset($item->active) && $item->active) | ||
| { | ||
| return '<li class="active hidden-phone"><a>' . $item->text . '</a></li>'; | ||
| $aria = JText::sprintf('JLIB_HTML_PAGE_CURRENT', $item->text); |
|
I have tested this item ✅ successfully on fa05cc6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18326. |
|
See #18357 for similar work on the ISIS template |
|
@ciar4n can you please test again? |
|
I'm seeing a lot of Could be wrong |
|
It s perfectly ok because there is no link in there it is ignored. We checked that before submitting as we were not sure either |
|
See the test report here https://gist.github.com/brianteeman/46e1cf36b6c57944c4b9c5efcad84c1d#gistcomment-2225785 |
Just use |
|
There is no need |
|
@brianteeman: Thanks to this work.
It's OK. |
|
I have tested this item ✅ successfully on fa05cc6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18326. |
|
The nav tag is absolutely required.and i will not be removing it. Every accessibility source clearly says that this is a requirement. I am not surprised that the a11y team once again chose to do nothing and instead criticise those that actually contribute to making joomla more accessible |
function pagination_list_footer($list)
{
$html = "<nav role=\"navigation\" aria-label=\"' . JText::_('JLIB_HTML_PAGINATION') . '\" class=\"pagination\">\n";
$html .= $list['pageslinks'];
$html .= "\n<input type=\"hidden\" name=\"" . $list['prefix'] . "limitstart\" value=\"" . $list['limitstart'] . "\" />";
$html .= "\n</nav>";
return $html;
}
|
|
your code will break the templates i will not be changing it |
|
OK. |
|
I have tested this item ✅ successfully on fa05cc6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18326. |
|
RTC after 3 successful tests. |
|
Thanks |
Improve thew accessibility of the pagination - there are no visual changes
Note 1
that the disabled links will not be announced to a screen reader which is the intended behaviour
Note 3
the list is an unordered list which appears to be the standard as otherwise the links would be announced as Link 1 go to page 2 etc which is nonsense
Note 4
I dont know why but protostar uses an override for pagination instead of the layout. For b/c this PR is just for the override but when approved I will do a similar PR for the layout
Thanks to @fuzzbomb (Drupal 8 Core Accessibility Maintainer) for his advice and reviewing this