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

FAQ a11y sign off updates #358

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JoshBowdenConcepts
Copy link
Contributor

Summary

A number of a11y changes to ensure full accessibility for the FAQ component.

List of notable changes:

  • added FAQ.Group to the FAQ component to provide accessible markup
  • updated Accordion summary spacing so that the focus would not obscure the text

What should reviewers focus on?

  • Making sure each of the items within this issue are addressed.

Steps to test:

  1. Open the FAQ component in CI-deployed preview environment
  2. Go to FAQ story in Storybook
  3. Verify that # behaves as described in the following issue.

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • New visual snapshots have been generated / updated for any UI changes
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

The spacing here between the heading and content is increased to allow for the focus border to not block the details text

Before After

image

image

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2023

⚠️ No Changeset found

Latest commit: 6425e59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -107,7 +107,7 @@ details[open] .Accordion__summary--expanded::after {
details[open] > .Accordion__content {
padding-left: var(--base-size-40);
padding-bottom: var(--base-size-24);
margin-top: calc(var(--base-size-16) * -1); /* for 8px gap between question and answer */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(sev 2) When the accordion controls are expanded using the keyboard, the focus indicator overlaps the first line of text in the panel decreasing readability.

This needed to be removed to support this a11y issue

@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2023

🟢 No design token changes found


function FAQGroup({className, children}: FAQGroupProps) {
return (
// eslint-disable-next-line jsx-a11y/no-redundant-roles
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sev 2) For all examples, the accordion controls are not using list semantics. Screen reader users will not be made aware of the grouped nature of the controls, nor how many items are in the collection.

Solution: Use an unordered list ul to wrap the related accordion controls, with an li wrapping each individual item. Add an aria-labelledby attribute to the ul, and reference the ID of the section heading. If list-style: none is applied with CSS, be sure to add role="list" to the ul element to ensure that all screen readers report the list structure. Some screen reader/browser combinations will remove list semantics if no bullets are present, and the explicit role declaration restores them.

This needed to be added to follow this guidance. Maybe the linter can be updated so we can remove this in the future.

@JoshBowdenConcepts JoshBowdenConcepts temporarily deployed to github-pages July 21, 2023 12:46 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2023

⚠️ Visual differences found

Our visual comparison tests found UI differences.

Please review the differences by using the test artifacts to ensure that the changes were intentional.

Artifacts can be downloaded and reviewed locally.

Download links are available at the bottom of the workflow summary screen.

Example:

artifacts section of workflow run

If the changes are expected, please run npm run test:visual:update-snapshots to replace the previous fixtures.

Review visual differences

@@ -120,8 +120,8 @@ export const AllOpen: StoryFn<typeof FAQ> = () => {
return (
<Container>
<FAQ>
<FAQ.Heading>Frequently asked&nbsp;questions</FAQ.Heading>
<>
<FAQ.Heading id="all-open-faq">Frequently asked&nbsp;questions</FAQ.Heading>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we apply this inside the component using a unique id? I suspect users may forget to do this otherwise so we could do it for them internally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How would you feel about making these props required and leaving information in the documentation? We could do this dynamically but it would require a second loop of the children to first grab the id if a user specifies one and then set the id on the group. Of course, if they didn't supply one then this second loop wouldn't be needed but I was thinking we would want to support them passing their own id if they wanted to access that component using an id query.

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

Successfully merging this pull request may close these issues.

None yet

2 participants