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

Merged
merged 6 commits into from
Jan 21, 2025
Merged

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

🦋 Changeset detected

Latest commit: f5b0283

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components 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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No visual regression - good sign!

- 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.

🎉

Copy link
Contributor

Choose a reason for hiding this comment

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

🎊

@khiga8

This comment was marked as off-topic.

Base automatically changed from kh-test-aria-snapshots to main January 16, 2025 18:21
@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

This comment was marked as outdated.

Apply flex so nested span is centered

Temp
Copy link
Contributor

@hectahertz hectahertz left a comment

Choose a reason for hiding this comment

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

Nice and clean, looks great!

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

Choose a reason for hiding this comment

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

🎊

@khiga8 khiga8 merged commit fa16aec into main Jan 21, 2025
34 checks passed
@khiga8 khiga8 deleted the kh-fix-10088 branch January 21, 2025 14:39
@primer primer bot mentioned this pull request Jan 21, 2025
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