Set up pagination tag directly with datatable
Set up pagination tag directly with datatable
Aurore
Posts: 3Questions: 0Answers: 0
I need to modify the html structure to meet accessibility criterias
Is it possible to set up pagination's tag directly with datatable ?
Example : <div class="dataTables_paginate ...</div>
to <nav class="dataTables_paginate ...></nav>
Or to add attributes to automatic elements ?
Example : Add a role attribute to <div id="table_processing" ...></div>
Thank you for your answer.
Replies
You'd need to modify the DataTables source if you wanted to use a
nav
rather than thediv
for the pagination wrapper.To add roles, you could use DOM methods - select the element and then add the role as needed. What role should the processing element have? I'm wondering if it should be added automatically if it is for accessibility.
Allan
Thank you
About the role, I was talking about this one : https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/status_role
I've added the
role=status
attribute to the processing element by default. That will be in 1.13.3, which I'm planning to tag and release todayAllan
Thank you!
Just in case, I'm sending you a topic about nav tag in paginations :
To ensure that the pagination is understandable by people using a screen reader, we mark the items up as a list inside a <nav> element, and then use CSS to display the layout visually as a row.
https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_cookbook/Pagination
Yes, I can see how that would be helpful. I see Bootstrap recommend that approach as well. I'll probably need to wrap the
div
to allow for older browsers, but that seems like a good enhancement to make.Allan