reactjs / reactjs/react.dev

Sidebar Dropdown Should Toggle When Clicking an Already-Selected Item

Open
#8,149 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

When a user selects a sidebar item with nested routes, the dropdown expands as expected. However, clicking the same selected item again does nothing, even though users naturally expect it to collapse. This leads to:

Reduced control over sidebar visibility

Unnecessary scrolling when sections cannot be collapsed

Lower consistency with typical documentation UI behavior

Expected Behavior

Clicking an already-selected sidebar item should toggle the visibility of its dropdown.

Clicking a non-selected item behaves normally (navigate + expand).

When navigating away, the collapsed state should reset automatically so the correct item appears expanded by default.

Contributor guide

Open the contributing guide

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 locating the sidebar item and nested-dropdown implementation in the React documentation site, then reproduce the behavior for selected and non-selected items. Verify that clicking the selected item collapses its dropdown, navigation still expands the correct item, and navigating away resets the collapsed state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation, 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.