Skip to content

Protostar pagination update#18326

Merged
mbabker merged 10 commits intojoomla:stagingfrom
brianteeman:protostar-pagination
Oct 23, 2017
Merged

Protostar pagination update#18326
mbabker merged 10 commits intojoomla:stagingfrom
brianteeman:protostar-pagination

Conversation

@brianteeman
Copy link
Copy Markdown
Contributor

@brianteeman brianteeman commented Oct 13, 2017

Improve thew accessibility of the pagination - there are no visual changes

  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 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

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
@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels Oct 13, 2017
}

$html = '<ul class="pagination-list">';
$html = '<nav role="navigation" aria-label="' . JText::_('JPAGINATION') . '">';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JPAGINATION... is that correct? Can't find this constant anywhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be JLIB_HTML_PAGINATION

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

if ($item->text === JText::_('JNEXT'))
{
$display = '<span class="icon-next"></span>';
$display = '<span class="icon-next" aria-hidden="true" ></span>';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space "true" >

@ciar4n
Copy link
Copy Markdown
Contributor

ciar4n commented Oct 13, 2017

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.

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Oct 13, 2017

I would prefer it to say Go to next page rather than Go to page Next. The same goes for Start, Prev, and End. Also should this change to use sprintf?

@brianteeman
Copy link
Copy Markdown
Contributor Author

@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

@brianteeman
Copy link
Copy Markdown
Contributor Author

@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>';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sprintf here? JText::_('JLIB_HTML_PAGE') . ' ' . $item->text

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Oct 15, 2017

Looks good!

Go to prev page I understand why it is prev, but it would be nice to be previous.

@brianteeman
Copy link
Copy Markdown
Contributor Author

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - we dont delete strings ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah whoops it was me that added it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this one too

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra spaces before =

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Oct 16, 2017

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.

@brianteeman
Copy link
Copy Markdown
Contributor Author

See #18357 for similar work on the ISIS template

@ghost
Copy link
Copy Markdown

ghost commented Oct 22, 2017

@ciar4n can you please test again?

@C-Lodder
Copy link
Copy Markdown
Member

C-Lodder commented Oct 22, 2017

I'm seeing a lot of <a> elements without href which I think may be an issue for a11y in regards to tab indexing.

@zwiastunsw ?

Could be wrong

@brianteeman
Copy link
Copy Markdown
Contributor Author

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

@brianteeman
Copy link
Copy Markdown
Contributor Author

@dgrammatiko
Copy link
Copy Markdown
Contributor

I'm seeing a lot of elements without href which I think may be an issue for a11y in regards to tab indexing.

Just use href="javascript:void(0)"

@brianteeman
Copy link
Copy Markdown
Contributor Author

There is no need

@zwiastunsw
Copy link
Copy Markdown
Contributor

zwiastunsw commented Oct 22, 2017

@brianteeman: Thanks to this work.
In my opinion, no additional nav tag is needed. Just replace the nav tag div in function pagination_list_footer. (This footer is part of navigation).
If you think you want to stay, as you proposed, let us know. Or correct.
And in one case and the other, I will test it successfully.

@C-Lodder:

I'm seeing a lot of elements without href which I think may be an issue for a11y in regards to tab indexing.

It's OK.

@ciar4n
Copy link
Copy Markdown
Contributor

ciar4n commented Oct 22, 2017

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.

@brianteeman
Copy link
Copy Markdown
Contributor Author

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

@zwiastunsw
Copy link
Copy Markdown
Contributor

zwiastunsw commented Oct 22, 2017

  1. I am sorry, but you misunderstood, of course, the nav tag is required. I have only proposed to include the whole element. Instead of div tag in function pagination_list_footer use nav tag:
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;
}
  1. It seems to me that directing, especially at my address, and not for the first time, the comments such as: " 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" is at least out of place.

  2. As I wrote earlier - if you leave the code unchanged, also I will test it successfully.

@brianteeman
Copy link
Copy Markdown
Contributor Author

brianteeman commented Oct 22, 2017

your code will break the templates i will not be changing it

@brianteeman brianteeman reopened this Oct 22, 2017
@zwiastunsw
Copy link
Copy Markdown
Contributor

OK.

@zwiastunsw
Copy link
Copy Markdown
Contributor

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.

@ghost
Copy link
Copy Markdown

ghost commented Oct 23, 2017

RTC after 3 successful tests.

@joomla-cms-bot joomla-cms-bot added RTC This Pull Request is Ready To Commit and removed RTC This Pull Request is Ready To Commit labels Oct 23, 2017
@brianteeman
Copy link
Copy Markdown
Contributor Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants