Unexpected behaviour with Atlaskit Tabs

I upgraded Atlaskit Tabs to the latest 8.0.8 version (previously on 4.0.0) and notice some strange behavior. In my case, I have a stateful component that renders tabs. The tab contents modify the state in the stateful component similar to the example here (adapted from the latest Tabs Basic example):

Problem:
If you go to Tab 4 and click the button it will always jump back to Tab 1.

Expected behavior:
I would expect it to stay on Tab 4 instead of jumping to Tab 1.

Workaround:
I found the easiest solution to fix this is to override the isSelectedTest function to simply compare the string labels.

The code on how the state is updated in the Tabs component is quite convoluted and I didn’t spend the time to fully understand what’s happening but I believe if you use default tab objects with ‘label’ and ‘content’ properties this should work out of the box.

Can anyone from Atlassian confirm that this is a bug or if not, how this should work?

2 Likes