reactjs / reactjs/react-tabs

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

Open
#327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.1k
Forks
455
Avg merge
5h 9m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with two instances of the react-tabs control on one page and inspect the generated tab and tab-panel IDs in the DOM. Compare the duplicate IDs and their associations, then consider the issue's proposed approaches; done means multiple instances have unique IDs and remain correctly linked for accessibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.