Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React] Pagination component accessibility improvements #1404

Open
sawyerh opened this issue Apr 29, 2021 · 2 comments
Open

[React] Pagination component accessibility improvements #1404

sawyerh opened this issue Apr 29, 2021 · 2 comments
Assignees

Comments

@sawyerh
Copy link

sawyerh commented Apr 29, 2021

Mayflower version: 11.4.1

There are a number of potential accessibility improvements for the Mayflower Pagination component:

  1. It does not indicate to screen readers which page is currently selected, although there is visual styling to indicate this for sighted users. aria-current="true" could be set on the selected page number.
  2. <a> element is used for essentially a <button>. The elements could instead be changed to a <button> if this behavior is preserved, however it would also be useful for projects to be able to define the href of the <a> element so that it behaves like a link. This would allow projects to render the component as static HTML and preserve the active page number state in the page URL. For example:
    <Pagination pages={[ { active: false, text: "2", href: "/my-page?page=2" } ]} ...

More details about accessible pagination components: https://www.a11ymatters.com/pattern/pagination/

@clairesunstudio
Copy link
Contributor

Good points! we probably initially just ported the component from pattenlab which was created for mass.gov only which didn't take into account SPAs. I will add this as a ticket to surface it on our Jira board, or if you are interested in submitting a PR you are very welcome to do so.

@clairesunstudio
Copy link
Contributor

clairesunstudio commented May 18, 2021

For 1. aria-current isn't supported in IE and firefox https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaCurrent. But we should definitely announce current page in aria-label
For 2. I noticed we are using <a> with role="button"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants