Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .changeset/anchored-overlay-clever-mails-roll.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
"@primer/react": patch
'@primer/react': patch
---

AnchoredOverlay accessibility fixes
- `aria-expanded` attribute is removed from anchor when overlay is not open
- `tabIndex=0` is removed from anchor because it should only be used with interactive elements

AnchoredOverlay: `aria-expanded` attribute is removed from anchor when overlay is not open
1 change: 1 addition & 0 deletions src/AnchoredOverlay/AnchoredOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const AnchoredOverlay: React.FC<AnchoredOverlayProps> = ({
id: anchorId,
'aria-haspopup': 'true',
'aria-expanded': open ? 'true' : undefined,
tabIndex: 0,
onClick: onAnchorClick,
onKeyDown: onAnchorKeyDown
})}
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/__snapshots__/ActionMenu.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ exports[`ActionMenu renders consistently 1`] = `
id="react-aria-1"
onClick={[Function]}
onKeyDown={[Function]}
tabIndex={0}
type="button"
>
<span
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/__snapshots__/AnchoredOverlay.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ exports[`AnchoredOverlay renders consistently 1`] = `
id="react-aria-1"
onClick={[Function]}
onKeyDown={[Function]}
tabIndex={0}
>
Anchor Button
</button>
Expand Down Expand Up @@ -201,6 +202,7 @@ exports[`AnchoredOverlay should render consistently when open 1`] = `
aria-haspopup="true"
class="c1"
id="react-aria-1"
tabindex="0"
>
Anchor Button
</button>
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/__snapshots__/SelectPanel.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ exports[`SelectPanel renders consistently 1`] = `
id="react-aria-1"
onClick={[Function]}
onKeyDown={[Function]}
tabIndex={0}
type="button"
>
Select Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ exports[`ActionMenu renders consistently 1`] = `
id="react-aria-1"
onClick={[Function]}
onKeyDown={[Function]}
tabIndex={0}
/>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ exports[`DropdownMenu renders consistently 1`] = `
id="react-aria-1"
onClick={[Function]}
onKeyDown={[Function]}
tabIndex={0}
type="button"
>
<svg
Expand Down