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

Add escape key handlers to open accordions and its inner content #523

Merged
merged 4 commits into from
Jan 24, 2024

Conversation

rezrah
Copy link
Collaborator

@rezrah rezrah commented Jan 23, 2024

Summary

Resolves #519

List of notable changes:

  • adds esc key press handler to open accordions titles, which both closes them and returns focus
  • adds esc key press handler to accordion content elements, which both closes the accordion and returns focus to the nearest toggle ancestor.

What should reviewers focus on?

  • Verify that the escape key event works as expected to close the accordions, whether it's on the toggle itself or inner link.

Steps to test:

  1. Open this story
  2. Use keyboard navigation to focus on a accordion summary
  3. Open accordion details using space or enter keys
  4. Press escape to close the accordion details
  5. Optionally test inner link contained in details, which should similarly close the accordion and return focus

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:

Escape key press event on accordion summaries:

Kapture.2024-01-23.at.13.43.44.mp4

Escape key press events on internal links on open accordions:

Kapture.2024-01-23.at.13.45.19.mp4

@rezrah rezrah requested a review from danielguillan January 23, 2024 13:53
Copy link

changeset-bot bot commented Jan 23, 2024

🦋 Changeset detected

Latest commit: d1ec238

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

This PR includes changesets to release 6 packages
Name Type
@primer/react-brand Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

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

Copy link
Contributor

github-actions bot commented Jan 23, 2024

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Jan 23, 2024

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@rezrah rezrah merged commit f6f4c66 into main Jan 24, 2024
15 of 16 checks passed
@rezrah rezrah deleted the rezrah/esc-accordion branch January 24, 2024 12:20
@primer-css primer-css mentioned this pull request Dec 19, 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.

[Accessibility] FAQ.Item is not getting closed using 'ESC' key
2 participants