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

Updated the accessible label of the SubNav's open/close toggle button to include the current page #838

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Nov 29, 2024

Summary

Following on from this discussion, I spotted a Sev-2 a11y issue which references the same underlying issue.

  • Fixes the above issue in the suggested way by removing the aria-label and instead adding visually-hidden text which describes the control and states the current page.
  • Removes test-ids from the SubNav's tests in favour of more accessibility-focussed queries
  • Replaces fireEvent usage in those tests with userEvent as we were previously using both in tests unnecessarily.

What should reviewers focus on?

  • Check you're happy with the approach
  • Check you're happy with the test changes

Steps to test:

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
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • 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

Copy link

changeset-bot bot commented Nov 29, 2024

🦋 Changeset detected

Latest commit: 68ae6ba

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

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (1)

packages/react/src/SubNav/SubNav.test.tsx:114

  • [nitpick] The test case name should be updated to reflect the new functionality. Consider renaming it to 'it('includes the aria-current text in the aria-label of the button', () => {'
it('shows the aria-current text next to the button by default', () => {

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

Copy link
Contributor

github-actions bot commented Nov 29, 2024

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Nov 29, 2024

⚠️ 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

@joshfarrant joshfarrant force-pushed the joshfarrant/subnav-label-a11y-fix branch from 9987147 to 66f7b76 Compare November 29, 2024 13:25
@joshfarrant joshfarrant force-pushed the joshfarrant/subnav-label-a11y-fix branch from 66f7b76 to f92d71c Compare November 29, 2024 13:26
@joshfarrant joshfarrant force-pushed the joshfarrant/subnav-label-a11y-fix branch from f92d71c to 68ae6ba Compare November 29, 2024 13:27
@joshfarrant joshfarrant changed the title Include the current page text in the aria-label of the SubNav's open/close toggle button Updated the accessible label of the SubNav's open/close toggle button to include the current page Nov 29, 2024
Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

Thanks @joshfarrant

@joshfarrant joshfarrant merged commit bf785d6 into main Nov 29, 2024
18 checks passed
@joshfarrant joshfarrant deleted the joshfarrant/subnav-label-a11y-fix branch November 29, 2024 16:20
@primer-css primer-css mentioned this pull request Nov 29, 2024
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.

2 participants