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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rare-panthers-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

CounterLabel: Do not parse children to string for visually hidden content
2 changes: 1 addition & 1 deletion src/CounterLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const CounterLabel: React.FC<React.PropsWithChildren<CounterLabelProps>> = ({
>
{children}
</Box>
<VisuallyHidden>&nbsp;{`(${children})`}</VisuallyHidden>
<VisuallyHidden>&nbsp;({children})</VisuallyHidden>
</>
)
}
Expand Down
30 changes: 18 additions & 12 deletions src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(120)
 (
120
)
</span>
</span>
</div>
Expand Down Expand Up @@ -386,8 +387,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(13)
 (
13
)
</span>
</span>
</div>
Expand Down Expand Up @@ -454,8 +456,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(5)
 (
5
)
</span>
</span>
</div>
Expand Down Expand Up @@ -494,8 +497,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(4)
 (
4
)
</span>
</span>
</div>
Expand Down Expand Up @@ -562,8 +566,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(9)
 (
9
)
</span>
</span>
</div>
Expand Down Expand Up @@ -653,8 +658,9 @@ exports[`UnderlineNav renders consistently 1`] = `
<span
className="c0"
>

(10)
 (
10
)
</span>
</span>
</div>
Expand Down
14 changes: 8 additions & 6 deletions src/__tests__/__snapshots__/CounterLabel.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ exports[`CounterLabel renders consistently 1`] = `
<span
className="c0"
>

(undefined)
 (
)
</span>,
]
`;
Expand Down Expand Up @@ -82,8 +82,9 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro
<span
class="c1"
>

(1234)
 (
1234
)
</span>
</div>
`;
Expand Down Expand Up @@ -127,8 +128,9 @@ exports[`CounterLabel respects the primary "scheme" prop 1`] = `
<span
class="c1"
>

(1234)
 (
1234
)
</span>
</div>
`;