diff --git a/packages/shared/src/components/header/FeedExploreHeader.tsx b/packages/shared/src/components/header/FeedExploreHeader.tsx index 06e78cc8f8..7f114845f6 100644 --- a/packages/shared/src/components/header/FeedExploreHeader.tsx +++ b/packages/shared/src/components/header/FeedExploreHeader.tsx @@ -106,6 +106,7 @@ export function FeedExploreHeader({ container: className.tabBarContainer, }} shouldMountInactive + tabTag="a" > {Object.entries(urlToTab).map(([url, label]) => ( diff --git a/packages/shared/src/components/tabs/TabContainer.tsx b/packages/shared/src/components/tabs/TabContainer.tsx index fd8b665d7d..dabeb18b56 100644 --- a/packages/shared/src/components/tabs/TabContainer.tsx +++ b/packages/shared/src/components/tabs/TabContainer.tsx @@ -7,7 +7,7 @@ import React, { } from 'react'; import classNames from 'classnames'; import { useRouter } from 'next/router'; -import TabList, { TabListProps } from './TabList'; +import TabList, { AllowedTabTags, TabListProps } from './TabList'; import { RenderTab } from './common'; export interface TabProps { @@ -48,6 +48,7 @@ export interface TabContainerProps { tabListProps?: Pick; showBorder?: boolean; renderTab?: RenderTab; + tabTag?: AllowedTabTags; } export function TabContainer({ @@ -61,6 +62,7 @@ export function TabContainer({ controlledActive, tabListProps = {}, renderTab, + tabTag, }: TabContainerProps): ReactElement { const router = useRouter(); @@ -144,6 +146,7 @@ export function TabContainer({ active={currentActive} className={tabListProps?.className} autoScrollActive={tabListProps?.autoScrollActive} + tag={tabTag} /> {render} diff --git a/packages/shared/src/components/tabs/TabList.tsx b/packages/shared/src/components/tabs/TabList.tsx index e3c36b46af..e401e4bef4 100644 --- a/packages/shared/src/components/tabs/TabList.tsx +++ b/packages/shared/src/components/tabs/TabList.tsx @@ -8,6 +8,8 @@ import React, { } from 'react'; import { RenderTab } from './common'; +export type AllowedTabTags = keyof Pick; + interface ClassName { indicator?: string; item?: string; @@ -25,6 +27,7 @@ export interface TabListProps { className?: ClassName; autoScrollActive?: boolean; renderTab?: RenderTab; + tag?: AllowedTabTags; } function TabList({ @@ -34,6 +37,7 @@ function TabList({ className = {}, autoScrollActive, renderTab, + tag: Tag = 'button', }: TabListProps): ReactElement { const hasActive = items.includes(active); const currentActiveTab = useRef(null); @@ -41,6 +45,7 @@ function TabList({ offset: 0, indicatorOffset: 0, }); + const isAnchor = Tag === 'a'; const scrollIfNotInView = useCallback(() => { const { activeTabRect, offset } = dimensions; @@ -113,7 +118,7 @@ function TabList({ ); return ( - + ); })} {!!indicatorOffset && hasActive && (