Incorrect keyboard interaction with ToggleButtonGroup type="radio"
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- bootstrap, javascript, react, typescript
- Domain
- accessibility, frontend
Research direction
Start by reproducing the issue in the linked CodeSandbox and inspect the ToggleButtonGroup entry point, focusing on the type="radio" behavior. Done means the group remains keyboard reachable, individual labels are skipped by Tab, and arrow-key selection still works without the labels receiving focus.
Written by the indexing model from the issue text.
Description
Prerequisites
- I am using the correct version of React-Bootstrap for my version of Bootstrap
- I have searched for duplicate or closed issues
- I have read the contributing guidelines
Describe the bug
I don't think ToggleButtons should render a label element with tabindex="0" when the parent ToggleButtonGroup has the type="radio" prop. It causes tab to focus on the labels without being useful to select them via keyboard interaction.
Expected behavior
When the ToggleButtonGroup is set up as a radio group, the group should be reachable by tab but the individual labels should not. Tab should take the focus out of the entire group as per standard radio functionality.
To Reproduce
In the example, tab to the button group, notice that you can use the keyboard arrow keys to change the selected value.
Tab again and the focus goes to the first label. Subsequent tabs focus on the next labels. However, the selected value doesn't change and you can't select it with a keyboard press.
Reproducible Example
https://codesandbox.io/s/nice-fog-2y88cm?file=/src/App.js
Screenshots
No response
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome
What version of React-Bootstrap are you using?
2.9.1
What version of Bootstrap are you using?
5.3.1
Additional context
No response
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 3.6k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-bootstrap/react-bootstrap
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
react-bootstrap/react-bootstrap#6989 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
react-bootstrap/react-bootstrap#6987 · 2 comments · 1 reaction ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
react-bootstrap/react-bootstrap#6985 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
react-bootstrap/react-bootstrap#6984 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
react-bootstrap/react-bootstrap#6962 · 1 comment ·
All issues in react-bootstrap/react-bootstrap
Similar issues
-
Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Difficulty 1/5 Under an hour Newbie friendliness 88/100
digidem/comapeo-cloud-app#403 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100