@@ -7,7 +7,7 @@ const Tabs = ({ tabs, basePath }) => {
77 const location = useLocation ( ) ;
88 const navigate = useNavigate ( ) ;
99 const tabRefs = useRef ( [ ] ) ;
10- const focusTargetRef = useRef ( null ) ;
10+ const focusRef = useRef ( null ) ;
1111
1212 const getTabIndexFromPath = ( ) => {
1313 if ( ! basePath ) return 0 ;
@@ -28,7 +28,7 @@ const Tabs = ({ tabs, basePath }) => {
2828 } , [ tabs ] ) ;
2929
3030 useEffect ( ( ) => {
31- const targetIndex = focusTargetRef . current ;
31+ const targetIndex = focusRef . current ;
3232 if (
3333 targetIndex !== null &&
3434 targetIndex === selectedTab &&
@@ -39,7 +39,7 @@ const Tabs = ({ tabs, basePath }) => {
3939 if ( tabRefs . current [ targetIndex ] ) {
4040 tabRefs . current [ targetIndex ] . focus ( ) ;
4141 }
42- focusTargetRef . current = null ;
42+ focusRef . current = null ;
4343 } , 0 ) ;
4444 }
4545 } , [ selectedTab , location . pathname ] ) ;
@@ -63,7 +63,7 @@ const Tabs = ({ tabs, basePath }) => {
6363 const pathIndex = getTabIndexFromPath ( ) ;
6464 // Don't update selectedTab if we're in the middle of a programmatic nav
6565 // (indicated by focusTargetRef being set)
66- if ( pathIndex !== selectedTab && focusTargetRef . current === null ) {
66+ if ( pathIndex !== selectedTab && focusRef . current === null ) {
6767 setSelectedTab ( pathIndex ) ;
6868 }
6969 } , [ location . pathname , tabs , basePath , selectedTab , navigate ] ) ;
@@ -107,7 +107,7 @@ const Tabs = ({ tabs, basePath }) => {
107107 }
108108
109109 event . preventDefault ( ) ;
110- focusTargetRef . current = newIndex ;
110+ focusRef . current = newIndex ;
111111 updateSelectedTab ( newIndex ) ;
112112 } ;
113113
0 commit comments