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

Fix pagelayout stories axe violations #3012

Merged
merged 18 commits into from
Mar 17, 2023

Conversation

radglob
Copy link
Contributor

@radglob radglob commented Mar 10, 2023

Adds tabIndex, role="region" and requires either an aria-label or aria-labelledby on the PageLayout.Pane component when overflow is detected. Overflow is determined by checking if the scrollHeight of the pane is greater than the clientHeight.

Closes https://github.com/github/primer/issues/1865.

Screenshots

Please provide before/after screenshots for any visual changes

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@radglob radglob requested review from a team and joshblack March 10, 2023 17:07
@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2023

🦋 Changeset detected

Latest commit: bd0e547

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 94.79 KB (+0.21% 🔺)
dist/browser.umd.js 95.38 KB (+0.17% 🔺)

@radglob radglob temporarily deployed to github-pages March 10, 2023 17:13 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 10, 2023 17:13 Inactive
@radglob radglob added the skip changeset This change does not need a changelog label Mar 10, 2023
@joshblack
Copy link
Member

Thanks for putting this up @radglob! Just wanted to double-check on requirements for this, I believe that for this we would need the following:

  • The PageLayout.Pane component needs to be aware of overflow
  • When overflow is detected, the PageLayout.Pane component will:
    • Add the tabIndex attribute1
    • Add role="region"1
    • Add aria-label with an accessible label or aria-labelledby to an appropriate element1

A big challenge for this component seems to be getting that aria-label or aria-labelledby to be a valid that's relevant since it only accepts children.

Is that you're understanding as well for this issue @ericwbailey @TylerJDev? Or is there anything missing?

Let me know if that makes sense @radglob or if I'm overthinking this 🤔

Footnotes

  1. https://www.tpgi.com/short-note-on-improving-usability-of-scrollable-regions/) 2 3

@TylerJDev
Copy link
Contributor

@joshblack - Yup, that is my understanding as well. I'm guessing we'll need to make the accessible name a required prop for pane? If so, we might need to emphasize on why that's needed so that developers give it a good name.

@radglob - Let me know if you want to pair on this issue! Josh listed all the items we'd need to make sure this is accessible, but if you have any questions on the accessible bits let me know! 😁

@radglob radglob temporarily deployed to github-pages March 13, 2023 19:22 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 13, 2023 19:22 Inactive
@radglob radglob temporarily deployed to github-pages March 14, 2023 13:27 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 14, 2023 13:28 Inactive
@radglob radglob temporarily deployed to github-pages March 15, 2023 13:54 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 15, 2023 13:54 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 15, 2023 13:54 Inactive
@radglob radglob removed the skip changeset This change does not need a changelog label Mar 15, 2023
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 15, 2023 14:15 Inactive
@radglob radglob temporarily deployed to github-pages March 15, 2023 14:17 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 15, 2023 14:18 Inactive
@radglob radglob temporarily deployed to github-pages March 16, 2023 13:30 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 16, 2023 13:30 Inactive
@radglob radglob temporarily deployed to github-pages March 16, 2023 18:48 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 16, 2023 18:48 Inactive
@radglob radglob temporarily deployed to github-pages March 16, 2023 19:16 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 16, 2023 19:16 Inactive
@radglob radglob temporarily deployed to github-pages March 16, 2023 19:35 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 16, 2023 19:36 Inactive
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I think only big thing is to make sure that one story gets the aria-label to stop it from error'ing out. I left a couple other comments too, let me know what you think!

From a package release perspective, how do you feel about emitting a warning instead of an error for the missing aria-label or aria-labelledby? This could prompt people to add the label without potentially causing existing code to fail. Just wanted to get your thoughts on this 👀

src/PageLayout/PageLayout.tsx Outdated Show resolved Hide resolved
src/PageLayout/PageLayout.tsx Outdated Show resolved Hide resolved
src/PageLayout/PageLayout.stories.tsx Show resolved Hide resolved
src/PageLayout/PageLayout.tsx Outdated Show resolved Hide resolved
@radglob radglob temporarily deployed to github-pages March 17, 2023 13:43 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3012 March 17, 2023 13:44 Inactive
@radglob
Copy link
Contributor Author

radglob commented Mar 17, 2023

Looks great! I think only big thing is to make sure that one story gets the aria-label to stop it from error'ing out. I left a couple other comments too, let me know what you think!

From a package release perspective, how do you feel about emitting a warning instead of an error for the missing aria-label or aria-labelledby? This could prompt people to add the label without potentially causing existing code to fail. Just wanted to get your thoughts on this 👀

I think it makes sense for this to be an error. Since it's an accessibility issue, it might be best to enforce that. Warnings tend to get ignored in my experience.

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@radglob radglob added this pull request to the merge queue Mar 17, 2023
@joshblack joshblack removed this pull request from the merge queue due to a manual request Mar 17, 2023
@joshblack
Copy link
Member

@radglob just a heads up, removed this from the queue as I'm going through the release right now. Will make sure to add it back when #3021 is merged!

@joshblack joshblack added this pull request to the merge queue Mar 17, 2023
@joshblack joshblack merged commit 04d9db0 into main Mar 17, 2023
@joshblack joshblack deleted the fix-pagelayout-stories-axe-violations branch March 17, 2023 16:13
@primer-css primer-css mentioned this pull request Mar 17, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants