reactjs / react-tabs

An accessible and easy tab component for ReactJS.

Home Page:https://reactcommunity.org/react-tabs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Named anchors within TabPanel only works for first tab

akshare opened this issue · comments

Named anchors within the content (TabPanel) only works within the first tab.
Named anchors in any other TabPanel triggers the first tab instead of going to the target within the same tab.

This works:

<Tabs>
    <TabList>
      <Tab>Title 1</Tab>
      <Tab>Title 2</Tab>
    </TabList>

    <TabPanel>
         <a href="#test">Anchor Link</a>
         <p>Any content 1</p>
         <a name="test">Anchor Target</a> 
    </TabPanel>
    <TabPanel>
      <h2>Any content 2</h2>
    </TabPanel>
  </Tabs>

This doesn't (it triggers first tab):

<Tabs>
    <TabList>
      <Tab>Title 1</Tab>
      <Tab>Title 2</Tab>
    </TabList>

    <TabPanel>
         <h2>Any content 1</h2>
    </TabPanel>
    <TabPanel>
         <a href="#test">Anchor Link</a>
         <p>Any content 2</p>
         <a name="test">Anchor Target</a> 
    </TabPanel>
  </Tabs>

Is there a fix or any workaround for this?

For me, it resolved once the next versions were out at the time (3.2.3).

Is this still an issue with the latest version?