Skip to content

Commit bc24c50

Browse files
committed
LabelGroup: Update "toggle" accessible name to include visual text (#4910)
* Update `LabelGroup` truncate button accName * Add changeset
1 parent d6c44a3 commit bc24c50

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.changeset/breezy-boxes-jog.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+
Changes the accessible name of the "toggle" button in `LabelGroup` to contain the visual label

packages/react/src/LabelGroup/LabelGroup.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,14 @@ const InlineToggle: React.FC<{
7373
hiddenItemIds,
7474
isOverflowShown,
7575
showAllTokensInline,
76-
totalLength,
7776
}) =>
7877
isOverflowShown ? (
7978
<Button ref={collapseButtonRef} onClick={collapseInlineExpandedChildren} size="small" variant="invisible">
8079
Show less
8180
</Button>
8281
) : hiddenItemIds.length ? (
8382
<Button ref={expandButtonRef} variant="invisible" size="small" onClick={showAllTokensInline}>
84-
<VisuallyHidden>Show all {totalLength}</VisuallyHidden>
83+
<VisuallyHidden>Show +{hiddenItemIds.length} more</VisuallyHidden>
8584
<span aria-hidden="true">+{hiddenItemIds.length}</span>
8685
</Button>
8786
) : null
@@ -106,7 +105,6 @@ const OverlayToggle: React.FC<
106105
openOverflowOverlay,
107106
overlayPaddingPx,
108107
overlayWidth,
109-
totalLength,
110108
}) =>
111109
hiddenItemIds.length ? (
112110
<AnchoredOverlay
@@ -123,7 +121,7 @@ const OverlayToggle: React.FC<
123121
alignmentOffset={overlayPaddingPx * -1}
124122
renderAnchor={props => (
125123
<Button variant="invisible" size="small" {...props} ref={expandButtonRef}>
126-
<VisuallyHidden>Show all {totalLength}</VisuallyHidden>
124+
<VisuallyHidden>Show +{hiddenItemIds.length} more</VisuallyHidden>
127125
<span aria-hidden="true">+{hiddenItemIds.length}</span>
128126
</Button>
129127
)}

0 commit comments

Comments
 (0)