react-tabs icon indicating copy to clipboard operation
react-tabs copied to clipboard

Accessibility Bug - Duplicate Ids Created When More Than One Instance of the Tabs Is Used on a Page

Open BLuEScioN opened this issue 5 years ago • 1 comments

This is an accessibility bug caused by the same id being used multiple times in the DOM. What react-tabs does to cause this bug is it autogenerates ids for the tabs it renders to the page. The ids start at 0, and are incremented for each tab and tab-panel rendered. This wouldn’t be a problem if the control is only used once, but when it's used more than once in your project, the separate instances of the control do not know about each other and so the ids for each instance of the control start at 0 and get incremented in the same way, causing id overlap. Ways this issue could be resolved: use random ids, require an instance of the tabs control to be given an id and use that id in the ids of the autogenerated ids for the tabs and tab panels.

By the way, I have made sure that I am using the most up to date version of react-tabs as of the time of writing this, 3.1.0.

BLuEScioN avatar May 22 '20 00:05 BLuEScioN

How do you use react-tabs? This should not happen, as the counter is never reset unless you do that yourself or include react-tabs multiple times (like physically in your bundle)

danez avatar Dec 13 '20 15:12 danez