Skip to content

Commit

Permalink
fix: Fix CompositeItem with tabindex=0 on the first render (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegohaz authored Jan 3, 2021
1 parent 9ae71ce commit 3d81514
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/reakit/src/Composite/CompositeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const useCompositeItem = createHook<
isCurrentItem) ||
// We don't want to set tabIndex="-1" when using CompositeItem as a
// standalone component, without state props.
!options.items?.length;
!options.items;

React.useEffect(() => {
if (!id) return undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/reakit/src/Grid/__tests__/GridCell-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test("render", () => {
<span
id="gridcell"
role="gridcell"
tabindex="0"
tabindex="-1"
/>
</div>
`);
Expand Down
2 changes: 1 addition & 1 deletion packages/reakit/src/Menu/__tests__/MenuItem-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test("render", () => {
<button
id="item"
role="menuitem"
tabindex="0"
tabindex="-1"
>
item
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test("render", () => {
id="item"
name="checkbox"
role="menuitemcheckbox"
tabindex="0"
tabindex="-1"
/>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion packages/reakit/src/Menu/__tests__/MenuItemRadio-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test("render", () => {
aria-checked="false"
id="item"
role="menuitemradio"
tabindex="0"
tabindex="-1"
/>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion packages/reakit/src/Radio/__tests__/Radio-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test("render", () => {
<input
aria-checked="false"
id="radio"
tabindex="0"
tabindex="-1"
type="radio"
value="radio"
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/reakit/src/Tab/__tests__/Tab-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test("render", () => {
aria-selected="false"
id="tab"
role="tab"
tabindex="0"
tabindex="-1"
>
tab
</button>
Expand Down Expand Up @@ -93,7 +93,7 @@ test("render selected", () => {
aria-selected="true"
id="tab"
role="tab"
tabindex="0"
tabindex="-1"
>
tab
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/reakit/src/Toolbar/__tests__/ToolbarItem-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test("render", () => {
<div>
<button
id="item"
tabindex="0"
tabindex="-1"
>
button
</button>
Expand Down

0 comments on commit 3d81514

Please sign in to comment.