Skip to content

Commit 738d587

Browse files
siddharthkpPrinceSumberia
authored andcommitted
AnchoredOverlay: Keep tabIndex for renderAnchor (primer#2159)
* Revert "remove tabIndex from AnchoredOverlay" This reverts commit e7f2d03. * remove change from changelog as well * update matching snapshots
1 parent 8506cfc commit 738d587

File tree

7 files changed

+9
-5
lines changed

7 files changed

+9
-5
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
---
2-
"@primer/react": patch
2+
'@primer/react': patch
33
---
44

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

src/AnchoredOverlay/AnchoredOverlay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export const AnchoredOverlay: React.FC<AnchoredOverlayProps> = ({
166166
id: anchorId,
167167
'aria-haspopup': 'true',
168168
'aria-expanded': open ? 'true' : undefined,
169+
tabIndex: 0,
169170
onClick: onAnchorClick,
170171
onKeyDown: onAnchorKeyDown
171172
})}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ exports[`ActionMenu renders consistently 1`] = `
130130
id="react-aria-1"
131131
onClick={[Function]}
132132
onKeyDown={[Function]}
133+
tabIndex={0}
133134
type="button"
134135
>
135136
<span

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ exports[`AnchoredOverlay renders consistently 1`] = `
8585
id="react-aria-1"
8686
onClick={[Function]}
8787
onKeyDown={[Function]}
88+
tabIndex={0}
8889
>
8990
Anchor Button
9091
</button>
@@ -201,6 +202,7 @@ exports[`AnchoredOverlay should render consistently when open 1`] = `
201202
aria-haspopup="true"
202203
class="c1"
203204
id="react-aria-1"
205+
tabindex="0"
204206
>
205207
Anchor Button
206208
</button>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ exports[`SelectPanel renders consistently 1`] = `
8989
id="react-aria-1"
9090
onClick={[Function]}
9191
onKeyDown={[Function]}
92+
tabIndex={0}
9293
type="button"
9394
>
9495
Select Items

src/__tests__/deprecated/__snapshots__/ActionMenu.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ exports[`ActionMenu renders consistently 1`] = `
7474
id="react-aria-1"
7575
onClick={[Function]}
7676
onKeyDown={[Function]}
77+
tabIndex={0}
7778
/>
7879
`;

src/__tests__/deprecated/__snapshots__/DropdownMenu.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ exports[`DropdownMenu renders consistently 1`] = `
7777
id="react-aria-1"
7878
onClick={[Function]}
7979
onKeyDown={[Function]}
80+
tabIndex={0}
8081
type="button"
8182
>
8283
<svg

0 commit comments

Comments
 (0)