Skip to content
5 changes: 5 additions & 0 deletions .changeset/great-shirts-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

UnderlineNav2: Add aria-hidden and sr-only class support for a descriptive "More" button label
6 changes: 4 additions & 2 deletions src/UnderlineNav2/UnderlineNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export const UnderlineNav = forwardRef(
aria-label={ariaLabel}
ref={navRef}
>
<NavigationList sx={ulStyles} ref={listRef}>
<NavigationList sx={ulStyles} ref={listRef} role="list">
{responsiveProps.items}
{actions.length > 0 && (
<MoreMenuListItem ref={moreMenuRef}>
Expand All @@ -318,7 +318,9 @@ export const UnderlineNav = forwardRef(
onClick={onAnchorClick}
trailingIcon={TriangleDownIcon}
>
More
<Box as="span">
More <VisuallyHidden as="span">{`${ariaLabel} items`}</VisuallyHidden>
</Box>
</Button>
<ActionList
selectionVariant="single"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ exports[`UnderlineNav renders consistently 1`] = `
>
<ul
className="c2"
role="list"
>
<li
className="c3"
Expand Down
2 changes: 1 addition & 1 deletion src/UnderlineNav2/interactions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ SelectAMenuItem.play = async ({canvasElement}: {canvasElement: HTMLElement}) =>
canvasElement.style.width = '800px'
await delay(2000)
const canvas = within(canvasElement)
const moreBtn = canvas.getByRole('button', {name: 'More'})
const moreBtn = canvas.getByRole('button', {name: 'More Repository items'})
userEvent.hover(moreBtn)
await delay(1000)
userEvent.click(moreBtn)
Expand Down