Skip to content

Add category navigation to search results#327

Closed
tracygardner wants to merge 2 commits intomainfrom
claude/add-search-categories-23LxC
Closed

Add category navigation to search results#327
tracygardner wants to merge 2 commits intomainfrom
claude/add-search-categories-23LxC

Conversation

@tracygardner
Copy link
Contributor

Summary

Enhanced the search plugin to display matching categories alongside matching blocks in search results, allowing users to quickly navigate to relevant toolbox categories.

Key Changes

  • Category Indexing: Added buildCategoryIndex() function that recursively traverses the toolbox schema to build a searchable index of all categories with their display names, paths, and styling information
  • Category Navigation: Implemented navigateToCategory() function that programmatically expands nested categories and selects the target category in the toolbox
  • Search Results Enhancement: Modified showMatchingBlocks() to accept and display category matches alongside block matches, with categories appearing in a separate section above blocks
  • UI Components:
    • Added "Categories" header label in search results
    • Created styled category navigation buttons with breadcrumb-style display for nested categories
    • Added visual separator between category and block results
  • Styling: Added comprehensive CSS for category search results including:
    • Header label styling (uppercase, small font, muted color)
    • Category button styling with rounded corners and hover effects
    • Per-category color scheme matching the toolbox category styles
    • Dark theme adjustments for better contrast

Implementation Details

  • Categories are indexed on first search and cached in workspace.flockCategoryIndex
  • Category search uses the same query matching as blocks (case-insensitive substring match)
  • Category buttons include parent category names in breadcrumb format for clarity in nested hierarchies
  • Navigation preserves the existing toolbox interaction patterns by expanding parent categories and selecting the target

https://claude.ai/code/session_012QbU2xUemokbaybUrz5VG3

When searching, matching categories and subcategories now appear at the
top of the flyout as clickable buttons above the matching blocks. Clicking
a category button navigates to that category in the toolbox sidebar and
opens its flyout (including expanding the parent first for subcategories).

- buildCategoryIndex() traverses the toolbox definition to collect all
  categories and subcategories with their display names and paths
- navigateToCategory() resolves the raw-name path to live toolbox items,
  expanding parents and selecting the target via ensurePointerFocusedSelection_
- matchBlocks now also filters the category index and passes matches to
  showMatchingBlocks
- showMatchingBlocks renders a "Categories" label + per-category buttons
  (with categorystyle-based CSS classes) before the block list
- CSS added for the category header label and per-categorystyle button colours

https://claude.ai/code/session_012QbU2xUemokbaybUrz5VG3
Blockly v12 places replaceMessageReferences under utils.parsing, not
directly on utils. Fix both the new buildCategoryIndex resolveDisplayName
helper and the pre-existing getBlockMessage helper which had the same bug
(it rarely fired because most blocks have a toString() result).

https://claude.ai/code/session_012QbU2xUemokbaybUrz5VG3
@tracygardner tracygardner deleted the claude/add-search-categories-23LxC branch February 27, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants