Skip to content

Commit

Permalink
fix(Tabs): correct aria-setsize count when Tabs are conditionally ren…
Browse files Browse the repository at this point in the history
…dered (#862)
  • Loading branch information
nathanyoung authored Jan 16, 2024
1 parent b8710eb commit 7fb27f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/Tabs/Tabs.Overview.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Button } from '../Button/Button';

The Tabs component allows a user to flip amongst different views within the same page. This helps users navigate related content without having to change context.

<Canvas isExpanded>
<Canvas withSource="open">
<Story
name="Default"
parameters={{
Expand All @@ -33,6 +33,7 @@ The Tabs component allows a user to flip amongst different views within the same
>
<Tabs.Item>Tab 1</Tabs.Item>
<Tabs.Item>Tab 2</Tabs.Item>
<Tabs.Item>Tab 3</Tabs.Item>
<Tabs.Item isDisabled>Disabled</Tabs.Item>
</Tabs>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const TabsBaseComponent: React.FC<TabsProps> = React.forwardRef(
key: child.key,
style: { ...child.props.style, ...(isFullWidth && { flex: 1 }) },
'aria-posinset': index + 1,
'aria-setsize': React.Children.count(children),
'aria-setsize': React.Children.toArray(children).length,
'aria-selected': value === index,
ref: mergeRefs([
value === index ? activeTabRef : null,
Expand Down

0 comments on commit 7fb27f4

Please sign in to comment.