Skip to content

CounterLabel: Do not parse children to string for visually hidden content #2850

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

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Feb 1, 2023

Closes #2837

We added a visually hidden content for CounterLabel to improve the accessibility. We added a non-breaking space   and wrapped the counter children with parentheses to allow screen readers to pause before reading the counter but we were also parsing the children to string and it caused issues for non-string or number children. This PR addresses this problem.

We actually do not need to parse it to string to be able to have the expected visually hidden content. So just removing it solves the issue.

Screenshots

Please provide before/after screenshots for any visual changes

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • 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.

@broccolinisoup broccolinisoup requested review from a team and josepmartins February 1, 2023 02:44
@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2023

🦋 Changeset detected

Latest commit: 4783246

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

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

@broccolinisoup broccolinisoup changed the title CounterLabel: Parse children as is for visually hidden content CounterLabel: Do not parse children to string for visually hidden content Feb 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 89.52 KB (+0.01% 🔺)
dist/browser.umd.js 90.15 KB (-0.01% 🔽)

@github-actions github-actions bot temporarily deployed to storybook-preview-2850 February 1, 2023 02:51 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages February 1, 2023 02:53 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2850 February 1, 2023 02:54 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages February 1, 2023 03:05 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2850 February 1, 2023 03:06 Inactive
Copy link
Contributor

@josepmartins josepmartins left a comment

Choose a reason for hiding this comment

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

LGTM! ❇️

@broccolinisoup broccolinisoup temporarily deployed to github-pages February 1, 2023 23:04 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2850 February 1, 2023 23:05 Inactive
@broccolinisoup broccolinisoup enabled auto-merge (squash) February 2, 2023 00:26
@broccolinisoup broccolinisoup temporarily deployed to github-pages February 2, 2023 00:28 — with GitHub Actions Inactive
@broccolinisoup broccolinisoup merged commit ca7398d into main Feb 2, 2023
@broccolinisoup broccolinisoup deleted the counterlabel-2837 branch February 2, 2023 00:33
@primer-css primer-css mentioned this pull request Feb 2, 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.

CounterLabel doesn't work for non-string children
2 participants