Skip to content

Commit

Permalink
CounterLabel: Do not parse children to string for visually hidden con…
Browse files Browse the repository at this point in the history
…tent (#2850)

* Parse children as is for visually hidden content

* update snapshots
  • Loading branch information
broccolinisoup authored Feb 2, 2023
1 parent 03b470b commit ca7398d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
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>
`;

0 comments on commit ca7398d

Please sign in to comment.