Set up pagination tag directly with datatable

Set up pagination tag directly with datatable

AuroreAurore Posts: 3Questions: 0Answers: 0
edited February 2023 in Free community support

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

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    You'd need to modify the DataTables source if you wanted to use a nav rather than the div 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

  • AuroreAurore Posts: 3Questions: 0Answers: 0

    Thank you

    About the role, I was talking about this one : https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/status_role

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    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 today :)

    Allan

  • AuroreAurore Posts: 3Questions: 0Answers: 0

    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

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    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

Sign In or Register to comment.