asyncapi / asyncapi/website

[BUG] TOC component lacks keyboard accessibility - uses div instead of button for interactive element

Open Beginner friendly
#4,972 5 comments 0 reactions 0 assignees View on GitHub
bug stale
Dominant language
TypeScript
Stars
716
Forks
1.2k
Avg merge
1d 12h
Merged PRs (30d)
35

Description

### Describe the bug.

The Table of Contents component in components/TOC.tsx has a keyboard accessibility issue. The toggle control uses a

element with an `onClick` handler instead of a semantic element, making it inaccessible to keyboard users and screen reader users.

The interactive element that toggles the TOC visibility is implemented as a div, which
Cannot be focused via keyboard navigation (Tab key)
Cannot be activated with keyboard (Space/Enter keys)

### Expected behavior

The TOC toggle should be a element
Should be focusable via keyboard Tab key
Should be activatable with Space or Enter keys
Should include aria-expanded attribute to indicate toggle state
Should include aria-label for screen reader context
Should maintain all existing visual styles and responsive behavior

### Screenshots

N/A - This is a semantic HTML/accessibility issue not visible in screenshots. The issue affects keyboard and screen reader users.

### How to Reproduce

1. Navigate to any page with a Table of Contents component e.g.documentation pages in small screen
2. Try to use Tab key to navigate through interactive elements on the page
3. Notice that the TOC toggle On this page section cannot be reached via keyboard
4. Screen reader users will not receive proper context about the toggle state

### 🖥️ Device Information [optional]

- Operating System (OS):
- Browser:
- Browser Version:

### 👀 Have you checked for similar open issues?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)

### Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Inspect components/TOC.tsx first, then open a documentation page at small-screen width and test the toggle with Tab, Enter, Space, and a screen reader. Done means the control is keyboard reachable and operable, exposes its expanded state and accessible label, and retains the current visual and responsive behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.