Open ZoeBijl opened 7 years ago
That is how I would mark-up a pagination so yes good idea.
I think it would help to have something to refer to.
Am I old fashioned in thinking that a fall-back grouping mechanism would be helpful?
E.g.
<nav aria-label="pagination">
<ul>
<li><a href="/pages/1">Previous</a></li>...
The links seem so naked on their own...
@alastc we could certainly add a list. We’ve a list in the breadcrumb example. If we do add one I think it should be an ordered list as the order is important in this case.
Didn’t add one to keep the code clean. I’m not sure there are any usability benefits to having the links inside a list. Had a discussion about this once with @LJWatson but I forgot what her conclusion was 😧.
I considered an ordered list, but often the link numbers don't match the list numbers, so I thought that could get confusing. E.g. "Item 1, previous; item 2, 1; item 3, 2, current page...".
I had a similar discussion with @LJWatson a few years back and I think the preference was for using lists as you get an immediate idea of how many items there are, and can skip over it. But that might be different in this context, so hope she can comment.
Perhaps consider using aria-posinset and aria-setsize. Not an ordered list which could become confusing.
@Decrepidos aria-posinset
isn’t allowed on links.
I think you want the word "page" in there also rather than a number, either aria-label, or offscreen text so it reads "page 1", "page 2." etc... to a screen reader.
@MichielBijl damn missed that bit 😁
@DavidMacDonald good point. I left it out because the thing is announced as “pagination” anyway. But perhaps it’s better to still add “page” to the links.
A lot of times the user will tab into it, and won't hear the "pagination" bit, and some users won't even know what "pagination" is, it sounds weird in a screen reader, and not a common word.
@DavidMacDonald that makes a bunch of sense, added them to the example code.
Would it be helpful if we added a pagination component/design pattern. It would be similar to the breadcrumb pattern. It could also have a single tab stop version.
Example markup:
Look forward to your feedback.