22
33import React , { memo , useCallback , useMemo , type ComponentPropsWithRef } from 'react' ;
44
5- import {
6- NavigationStatusContext ,
7- useHash ,
8- useIsMounted ,
9- useListOverflow ,
10- } from '@/components/hooks' ;
5+ import { useHash , useIsMounted , useListOverflow } from '@/components/hooks' ;
116import { DropdownMenu , DropdownMenuItem } from '@/components/primitives' ;
127import { useLanguage } from '@/intl/client' ;
138import { tString } from '@/intl/translate' ;
@@ -74,7 +69,6 @@ export function DynamicTabs(props: {
7469} ) {
7570 const { id, tabs, className } = props ;
7671 const router = useRouter ( ) ;
77- const { onNavigationClick } = React . useContext ( NavigationStatusContext ) ;
7872
7973 const hash = useHash ( ) ;
8074 const [ tabsState , setTabsState ] = useTabsState ( ) ;
@@ -106,8 +100,7 @@ export function DynamicTabs(props: {
106100
107101 const href = `#${ tab . id } ` ;
108102 if ( window . location . hash !== href ) {
109- router . replace ( href ) ;
110- onNavigationClick ( href ) ;
103+ router . replace ( href , { scroll : false } ) ;
111104 }
112105
113106 setTabsState ( ( prev ) => {
@@ -128,7 +121,7 @@ export function DynamicTabs(props: {
128121 } ;
129122 } ) ;
130123 } ,
131- [ onNavigationClick , router , setTabsState , tabs , id ]
124+ [ router , setTabsState , tabs , id ]
132125 ) ;
133126
134127 // When the hash changes, we try to select the tab containing the targetted element.
@@ -184,7 +177,10 @@ const TabPanel = memo(function TabPanel(props: {
184177 role = "tabpanel"
185178 id = { tab . id }
186179 aria-labelledby = { getTabButtonId ( tab . id ) }
187- className = { tcls ( 'p-4' , isActive ? null : 'hidden' ) }
180+ className = { tcls (
181+ 'scroll-mt-[calc(var(--content-scroll-margin)+var(--spacing)*12)] p-4' ,
182+ isActive ? null : 'hidden'
183+ ) }
188184 >
189185 { tab . body }
190186 </ div >
0 commit comments