diff --git a/.changeset/rare-panthers-smash.md b/.changeset/rare-panthers-smash.md new file mode 100644 index 00000000000..98872fa0c7d --- /dev/null +++ b/.changeset/rare-panthers-smash.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +CounterLabel: Do not parse children to string for visually hidden content diff --git a/src/CounterLabel.tsx b/src/CounterLabel.tsx index 3229aa6ae30..794c56d985a 100644 --- a/src/CounterLabel.tsx +++ b/src/CounterLabel.tsx @@ -38,7 +38,7 @@ const CounterLabel: React.FC> = ({ > {children} -  {`(${children})`} +  ({children}) ) } diff --git a/src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap b/src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap index 0d52ca43a98..312419e8d1c 100644 --- a/src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap +++ b/src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap @@ -318,8 +318,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (120) +  ( + 120 + ) @@ -386,8 +387,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (13) +  ( + 13 + ) @@ -454,8 +456,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (5) +  ( + 5 + ) @@ -494,8 +497,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (4) +  ( + 4 + ) @@ -562,8 +566,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (9) +  ( + 9 + ) @@ -653,8 +658,9 @@ exports[`UnderlineNav renders consistently 1`] = ` -   - (10) +  ( + 10 + ) diff --git a/src/__tests__/__snapshots__/CounterLabel.test.tsx.snap b/src/__tests__/__snapshots__/CounterLabel.test.tsx.snap index 2bb89ed40b6..4fed3becb94 100644 --- a/src/__tests__/__snapshots__/CounterLabel.test.tsx.snap +++ b/src/__tests__/__snapshots__/CounterLabel.test.tsx.snap @@ -37,8 +37,8 @@ exports[`CounterLabel renders consistently 1`] = ` -   - (undefined) +  ( + ) , ] `; @@ -82,8 +82,9 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro -   - (1234) +  ( + 1234 + ) `; @@ -127,8 +128,9 @@ exports[`CounterLabel respects the primary "scheme" prop 1`] = ` -   - (1234) +  ( + 1234 + ) `;