Skip to content

Commit

Permalink
fix: don't generate <Tab> ids from the <Tabs>'s aria-labelledby
Browse files Browse the repository at this point in the history
Think about it, this would mean
- All tabs would get the same id
- The id used would be the same as another element outside the tabs

Neither of these make any sense.
  • Loading branch information
ahuth committed Sep 29, 2022
1 parent 5d6acc9 commit 20859e9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Tab from '../Tab';

export interface Props {
/**
* The aria-labelledby attribute creates a relationship between the tab list and the tab panels
* Reference to another element that describes the purpose of the set of tabs.
*/
'aria-labelledby'?: string;
/**
Expand Down Expand Up @@ -78,10 +78,7 @@ export const Tabs = ({
[tabs],
);

const tabIds = useMemo(
() => tabs.map((tab) => tab.props['aria-labelledby'] || getUID(tab)),
[tabs, getUID],
);
const tabIds = useMemo(() => tabs.map(getUID), [tabs, getUID]);

// Set the active tab if the `activeIndex` prop changes.
const prevActiveIndex = usePrevious(activeIndex);
Expand Down

0 comments on commit 20859e9

Please sign in to comment.