Accessibility Fix: Add pagination markup for screen reader users to pagination
-
Hi Tobias,
Thanks for this great plugin. Would you please be able to update the pagination to have the expected HTML markup for screen reader users?
Pagination helps the assistive technology users navigate the content. Here are recommendations for improving TablePress pagination:
- Place the pagination elements in a nav tag. If you do not use a nav tag, you need to add role=”navigation” to the existing div.
- Include an aria-label=”pagination” on the nav tag (or div with role of navigation) to describe the type of navigation.
- Add meaningful aria-labels to the pagination links, for example aria-label=”next page” rather than just the words next or previous.
Here’s your current pagination code:
<div class="dataTables_paginate paging_simple" id="tablepress-frontpage-no-2_paginate">
<a class="paginate_button previous disabled" aria-controls="tablepress-frontpage-no-2" aria-disabled="true" role="link" data-dt-idx="previous" tabindex="-1" id="tablepress-frontpage-no-2_previous">Previous</a>
<a class="paginate_button next" aria-controls="tablepress-frontpage-no-2" role="link" data-dt-idx="next" tabindex="0" id="tablepress-frontpage-no-2_next">Next</a>
</div>Improved code:
<!-- Option 1 -->
<nav class="dataTables_paginate paging_simple" id="tablepress-frontpage-no-2_paginate" aria-label="table pagination">
<a class="paginate_button previous disabled" aria-controls="tablepress-frontpage-no-2" aria-disabled="true" role="link" data-dt-idx="previous" tabindex="-1" id="tablepress-frontpage-no-2_previous" aria-label="previous page">Previous</a>
<a class="paginate_button next" aria-controls="tablepress-frontpage-no-2" role="link" data-dt-idx="next" tabindex="0" id="tablepress-frontpage-no-2_next" aria-label="next page">Next</a>
</nav>
<!-- Option 2 -->
<div class="dataTables_paginate paging_simple" id="tablepress-frontpage-no-2_paginate" role="navigation" aria-label="table pagination">
<a class="paginate_button previous disabled" aria-controls="tablepress-frontpage-no-2" aria-disabled="true" role="link" data-dt-idx="previous" tabindex="-1" id="tablepress-frontpage-no-2_previous" aria-label="previous page">Previous</a>
<a class="paginate_button next" aria-controls="tablepress-frontpage-no-2" role="link" data-dt-idx="next" tabindex="0" id="tablepress-frontpage-no-2_next" aria-label="next page">Next</a>
</div>In addition to this, it would be great to add an option which allows numbered pagination to be turned on. Here’s a good example of accessible code for numbered pagination.
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.