Skip to content

Commit ca7398d

Browse files
CounterLabel: Do not parse children to string for visually hidden content (#2850)
* Parse children as is for visually hidden content * update snapshots
1 parent 03b470b commit ca7398d

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

.changeset/rare-panthers-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
CounterLabel: Do not parse children to string for visually hidden content

src/CounterLabel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const CounterLabel: React.FC<React.PropsWithChildren<CounterLabelProps>> = ({
3838
>
3939
{children}
4040
</Box>
41-
<VisuallyHidden>&nbsp;{`(${children})`}</VisuallyHidden>
41+
<VisuallyHidden>&nbsp;({children})</VisuallyHidden>
4242
</>
4343
)
4444
}

src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ exports[`UnderlineNav renders consistently 1`] = `
318318
<span
319319
className="c0"
320320
>
321-
 
322-
(120)
321+
 (
322+
120
323+
)
323324
</span>
324325
</span>
325326
</div>
@@ -386,8 +387,9 @@ exports[`UnderlineNav renders consistently 1`] = `
386387
<span
387388
className="c0"
388389
>
389-
 
390-
(13)
390+
 (
391+
13
392+
)
391393
</span>
392394
</span>
393395
</div>
@@ -454,8 +456,9 @@ exports[`UnderlineNav renders consistently 1`] = `
454456
<span
455457
className="c0"
456458
>
457-
 
458-
(5)
459+
 (
460+
5
461+
)
459462
</span>
460463
</span>
461464
</div>
@@ -494,8 +497,9 @@ exports[`UnderlineNav renders consistently 1`] = `
494497
<span
495498
className="c0"
496499
>
497-
 
498-
(4)
500+
 (
501+
4
502+
)
499503
</span>
500504
</span>
501505
</div>
@@ -562,8 +566,9 @@ exports[`UnderlineNav renders consistently 1`] = `
562566
<span
563567
className="c0"
564568
>
565-
 
566-
(9)
569+
 (
570+
9
571+
)
567572
</span>
568573
</span>
569574
</div>
@@ -653,8 +658,9 @@ exports[`UnderlineNav renders consistently 1`] = `
653658
<span
654659
className="c0"
655660
>
656-
 
657-
(10)
661+
 (
662+
10
663+
)
658664
</span>
659665
</span>
660666
</div>

src/__tests__/__snapshots__/CounterLabel.test.tsx.snap

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ exports[`CounterLabel renders consistently 1`] = `
3737
<span
3838
className="c0"
3939
>
40-
 
41-
(undefined)
40+
 (
41+
)
4242
</span>,
4343
]
4444
`;
@@ -82,8 +82,9 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro
8282
<span
8383
class="c1"
8484
>
85-
 
86-
(1234)
85+
 (
86+
1234
87+
)
8788
</span>
8889
</div>
8990
`;
@@ -127,8 +128,9 @@ exports[`CounterLabel respects the primary "scheme" prop 1`] = `
127128
<span
128129
class="c1"
129130
>
130-
 
131-
(1234)
131+
 (
132+
1234
133+
)
132134
</span>
133135
</div>
134136
`;

0 commit comments

Comments
 (0)