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

Ensure counter content is exposed to screen reader users #3270

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

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Jan 15, 2025

What are you trying to accomplish?

This PR ensures the counter content is exposed to screen reader users.

Before accessible name -comment ()
After accessible name - comment (15)

This removes the aria-hidden attribute from the counter component and sets sr-only or aria-hidden: true directly on respective counters in the view file. We want to render one span visually for sighted users (without parenthesis), and one span for screen reader users (with parenthesis to help the announcement).

This unintentional bug was introduced in #2807 😓 .

Screenshots

Integration

List the issues that this change affects.

https://github.com/github/accessibility-audits/issues/10088

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Anything you want to highlight for special attention from reviewers?

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • 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.

Copy link

changeset-bot bot commented Jan 15, 2025

⚠️ No Changeset found

Latest commit: 020530b

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

This comment was marked as outdated.

@@ -9,8 +9,8 @@
<% if trailing_visual %>
<span class="Button-visual Button-trailingVisual">
<% if @trailing_visual_counter %>
<span class="d-flex" aria-hidden="true"><%= trailing_visual %></span>
Copy link
Contributor Author

@khiga8 khiga8 Jan 16, 2025

Choose a reason for hiding this comment

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

Setting flex on this newly added span to ensure content remains centered.

- button "Button ( )": Button ()
- button "Button ( )": Button ()
- button "Button ( )": Button ()
- button "Button ( 15 )"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🎉

@khiga8
Copy link
Contributor Author

khiga8 commented Jan 16, 2025

I still need to test this on screen reader.

Base automatically changed from kh-test-aria-snapshots to main January 16, 2025 18:21
Apply flex so nested span is centered

Temp
@khiga8
Copy link
Contributor Author

khiga8 commented Jan 16, 2025

Just merged in the latest from main so the snapshots will get re-generated as part of Test / Visual and Semantic Markup Regressions !

@khiga8
Copy link
Contributor Author

khiga8 commented Jan 16, 2025

Tell me why 900+ snapshots changed 🙃

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.

1 participant