Skip to content

Command reference category links should filter, not just scroll #525

@cnuthalapati

Description

@cnuthalapati

Problem

On the Command Reference page, clicking a category in the sidebar (e.g., "Search" at /commands/#search) only scrolls the browser to that group heading. All other command groups remain visible on the page.

With 200+ commands across 20+ groups, this makes the category navigation feel broken and incomplete. Users expect clicking "Search" to show only search commands, similar to how the search box filters results in real time.

Current behavior

  1. User clicks "Search" in sidebar
  2. Page scrolls to the Search group heading
  3. All other groups (String, List, Hash, etc.) remain visible above and below
  4. No visual indicator of which category is active in the sidebar

Expected behavior

  1. User clicks "Search" in sidebar
  2. Only Search commands are shown (other groups hidden)
  3. Sidebar highlights "Search" as the active category
  4. URL updates to /commands/#search (shareable)
  5. Clicking "All" or clearing the filter shows everything again

Suggested implementation

Add a small JavaScript handler that:

  1. Listens for hashchange events and checks location.hash on page load
  2. When a group hash is present, hides all .command-group divs except the matching one (same pattern the existing search box uses)
  3. Adds an .active class to the matching sidebar link
  4. Clears the filter when hash is removed or a "Show All" link is clicked

The existing searchCommands() function already implements show/hide logic for .command-group and .command-entry elements, so this would follow the same pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions