Closed CharlotteDowns closed 1 year ago
I think the ismplest way of doing this would be a visually-hidden element with info on the current page in it and aria-current="page"
. Existing implementations would need updating to add this previously unnecessary information, however.
@querkmachine do you know if this would be a 'breaking change' for existing implementations of the 'previous / next' pagination variant?
@davidc-gds Assuming we would only be adding in new 'stuff', rather than changing or removing what's already there, then this wouldn't be a breaking change, no.
Rather than making a code change, this could also be an argument for not using the previous / next style of pagination for numbered pages of results.
I think the primary use case for this style of navigation is for linking between e.g. pages of guidance designed to be read sequentially, where the previous and next page are identified by their title rather than a number (such as in this example).
Although there are other examples of using the previous / next style for numbered pages (like in GOV.UK's publishing component guide) I'm not sure how often it's used in practise, nor whether we've done any research on it.
So my suggestion would be to instead explore:
If we were to make a change to the component, I think we should be doing so with 'navigating sequential pages of guidance' as the primary use case in mind.
Just weighing in that @36degrees's suggestions sound sensible to slightly adjusting the use case for prev/next pagination.
With guidance, the page numbers feel like a less-useful placeholder for descriptive labels since a) it's not supposed to be used for linear journeys and b) templates that use this like the mainstream guide example has a table of contents.
And subjectively from me, it does look a bit odd to me in the search results example.
@CharlotteDowns We've now merged a change to the guidance to clarify the expected use case for this kind of pagination, based on the previous two comments. https://github.com/alphagov/govuk-design-system/pull/2964
As the component no longer explicitly numbers the pages, we don't think it needs to include what the current page is either. Do you feel this satisfies the problem originally raised in the audit?
Hey all, for what it's worth, I did stumble across a version of the pagination component in the wild last week, and that one did use the 'Page 1 of X' style. I think it could also be argued that even with the current "next page" and "previous page" stuff, it might be good to have the current page info available? I have no idea how that would work in practice though.
Should we perhaps add even stronger guidance discouraging the use of numbers in the 'bloc' pagination style though? And say something like:
"The text under 'next' and 'previous' needs to describe the content it links to. Ideally, it should be the page's title."
I agree, I think this does satisfy the problem originally raised in the audit.
I also agree with the point that David raises to make stronger guidance to discourage numbers. Maybe we should collect these 'in the wild' examples somewhere so we can really identify why the pagination component is being used in that way and whether there is in fact a need to reference the current page number in those cases.
This issue is from May 2023 external accessibility audit report.
Usability issue
Issue ID: DAC_Usability_Pagination_01
URLs: https://govuk-frontend-pr-3503.herokuapp.com/full-page-examples/search-three-pages
Screen shots
The pagination method used does not indicate to users which page they are currently on and relies on the user to decipher this information from the context of the previous and next links, which some users may not be able to do with ease.
Current code ref(s)
#main-content > form > div.govuk-grid-row > div.govuk-grid-column-two-thirds > nav
Low vision user comments
Cognitive user comments
Solution
Consider using the pagination method which indicates the current page for users and not just the next and previous pages.