This web component creates a mostly accessible (please see note) pagination element.
https://codepen.io/annoyingmouse/pen/YzOMYyv
<wc-pagination total="1000"
current="1"
page-size="15"></wc-pagination>
<script type="module" src="wc-pagination.js"></script>The pagination relies on three attributes.
- The
totalnumber variable is the total number of records. - The
currentnumber variable indicates the current page. - The
page-sizenumber variable specifies the number of records per page.
Lots of accessibility features have been added recently, but I'm sure I'm missing some; please do get in touch with any issues you discover, as I'm hoping to make this as accessible as possible.
MIT