-
Couldn't load subscription status.
- Fork 639
fix(Pagination): Use anchor instead of button for disabled prev/next controls #4951
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
fix(Pagination): Use anchor instead of button for disabled prev/next controls #4951
Conversation
🦋 Changeset detectedLatest commit: cca5a45 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
| margin: 0 2px; | ||
| &:first-child { | ||
| margin-right: 6px; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to do this to enforce no visual regressions when changing from button to anchor to account for the 2px border all buttons have. Couldn't find a mapping in the theme spaces but happy to do this differently if there's a better alternative!
…ce-make-disabled-previousnext-control-non-focusable
…ce-make-disabled-previousnext-control-non-focusable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick comment, but otherwise looks good!
| content = 'Previous' | ||
| if (page.disabled) { | ||
| Object.assign(props, {as: 'button', 'aria-disabled': 'true'}) | ||
| Object.assign(props, {'aria-disabled': 'true'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add role="link" here, since I believe we'd only need it when the link is disabled. This should allow us to remove it below in the else condition
…5-prcpagination-best-practice-make-disabled-previousnext-control-non-focusable
|
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/341793 |
…controls (#4951) * fix(Pagination): a11y improvements * Create friendly-boats-serve.md * fix(Pagination): only add role link to disabled anchors
Closes #https://github.com/github/primer/issues/3395
Makes the Previous/Next controls in
Paginationnon-focusable by rendering them asas instead ofbutton. Also addsrole="link" to all's in the component.Changelog
New
buttonborders andasChanged
ainstead ofbuttonto make them non-focusablerole="link"to all<a>'s (Next, Previous and page numbers) in the component to improve accessibilityRemoved
Rollout strategy
Testing & Reviewing
Integration Test PR: https://github.com/github/github/pull/341793
role="link"on themaria-disabledanchor, not a button. Confirm there's nohreforroleattribute on itaria-disabledanchor, not a button. Confirm there's nohreforroleattribute on itMerge checklist