diff --git a/src/packages/tabs/tabs.tsx b/src/packages/tabs/tabs.tsx index 9309ddb39e..103cbdb4a8 100644 --- a/src/packages/tabs/tabs.tsx +++ b/src/packages/tabs/tabs.tsx @@ -101,10 +101,12 @@ export const Tabs: FunctionComponent> & { const scrollIntoView = (index: number, immediate?: boolean) => { const nav = navRef.current const titleItem = titleItemsRef.current - if (!nav || !titleItem || !titleItem[index]) { + const titlesLength = titles.current.length + const itemLength = titleItemsRef.current.length + if (!nav || !titleItem || !titleItem[itemLength - titlesLength + index]) { return } - const title = titleItem[index] + const title = titleItem[itemLength - titlesLength + index] let to = 0 if (direction === 'vertical') {