Skip to content

feat(docs): Add search functionality and component thumbnails#3405

Merged
chrisolsen merged 1 commit intodevfrom
tom/docs-search-feature
Mar 5, 2026
Merged

feat(docs): Add search functionality and component thumbnails#3405
chrisolsen merged 1 commit intodevfrom
tom/docs-search-feature

Conversation

@twjeffery
Copy link
Copy Markdown
Collaborator

@twjeffery twjeffery commented Feb 9, 2026

Summary

Two improvements to the docs site:

1. Component Thumbnails

  • Adds SVG thumbnail images for all components
  • Displayed in the ComponentsGrid for visual browsing

2. Search Functionality (⌘K command palette)

  • ⌘K / Ctrl+K opens search modal from anywhere
  • FlexSearch indexes 130 entries (49 components + 81 examples)
  • OS detection shows correct keyboard shortcut (Mac vs Windows)
  • Hero search button on homepage triggers modal
  • Mobile search icon in header opens modal
  • Nav menu search buttons with label hidden when collapsed
  • Quick links use GoA icons matching sidebar navigation
  • Filter commands — type /c for components, /e for examples
  • Accessibility — focus trap, keyboard navigation, ARIA labels

Changes

New files:

  • docs/public/images/component-thumbnails/*.svg (48 thumbnails)
  • docs/src/components/search/* (13 modules)
  • docs/src/scripts/build-search-index.ts
  • docs/src/pages/search.astro (fallback page)

Deleted orphaned files:

  • SideNav.tsx, ExamplesSideNav.tsx (replaced by SiteNav)
  • Search.tsx (replaced by new search modal)

Test plan

  • Component thumbnails display in /components grid
  • ⌘K / Ctrl+K opens modal from any page
  • Click hero search button on homepage → modal opens
  • Click mobile header search icon → modal opens
  • Nav search button works (expanded & collapsed states)
  • Arrow keys navigate results, Enter selects
  • Escape closes modal and restores focus

Created with the help of Claude.

Related issue:

#3366

@twjeffery twjeffery marked this pull request as ready for review February 9, 2026 21:59
@chrisolsen chrisolsen self-requested a review February 18, 2026 15:35
@Spark450 Spark450 requested review from ArakTaiRoth and bdfranck and removed request for bdfranck February 18, 2026 22:46
@twjeffery twjeffery linked an issue Feb 19, 2026 that may be closed by this pull request
2 tasks
Comment thread docs/src/components/search/SearchResults.tsx Outdated
Comment thread docs/src/components/search/SearchModal.tsx Outdated
Comment thread docs/src/components/ComponentsGrid.tsx
Comment thread docs/src/components/search/SearchModal.tsx Outdated
Comment thread docs/src/components/search/useSearch.ts
Comment thread docs/src/components/search/SearchPage.tsx
@twjeffery twjeffery force-pushed the tom/docs-search-feature branch from ff5f107 to 8c38f67 Compare February 23, 2026 19:23
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 23, 2026

Deploy Preview for goa-design-2 ready!

Name Link
🔨 Latest commit 94257e1
🔍 Latest deploy log https://app.netlify.com/projects/goa-design-2/deploys/69a8da32f03b980008d4946a
😎 Deploy Preview https://deploy-preview-3405--goa-design-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread docs/src/components/nav/ParentMenu.tsx Outdated
badge="/"
url="/search"
/>
<button className="search-menu-button" onClick={openSearch} type="button">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the search button is just a rendered button and not using WorkSideMenuItem. There's no aria-label being assigned to it right now. So when the menu is collapsed, there's no indication of what it is for screen readers, because on line 153, the text elements literally disappear from the DOM when the menu is collapsed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added aria-label="Search" to the button so screen readers can identify it when the menu is collapsed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twjeffery You did indeed add this here. But it's also missing in ComponentsSubMenu.tsx on line 219.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But on that note, I'm not sure why we're duplicating this secondary content in every menu? It looks like it's duplicated in this file, ComponentsSubMenu.tsx, ExampleSubMenu.tsx, and TokensSubMenu.tsx? This issue is in all of these, but currently I don't think the last two are being used, so I didn't highlight them as issues.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted MenuSecondaryContent to replace the duplicated secondary content across the nav files. The aria-label="Search" fix is in that component. I also deleted ExamplesSubMenu.tsx and TokensSubMenu.tsx since they weren't being used.

Comment thread docs/src/components/search/SearchModal.tsx
@twjeffery twjeffery force-pushed the tom/docs-search-feature branch from f3c2509 to bd4cd9f Compare February 26, 2026 19:59
@twjeffery twjeffery force-pushed the tom/docs-search-feature branch from bd4cd9f to 7328ce4 Compare March 3, 2026 00:37
@twjeffery
Copy link
Copy Markdown
Collaborator Author

@ArakTaiRoth I pushed changes as we discussed, it's ready for another review

@twjeffery twjeffery force-pushed the tom/docs-search-feature branch from 7328ce4 to de8e566 Compare March 3, 2026 15:27
@chrisolsen
Copy link
Copy Markdown
Collaborator

@twjeffery you will need to rebase to get the failing calendar test fix

@ArakTaiRoth
Copy link
Copy Markdown
Collaborator

@chrisolsen This has been done, it's ready to be merged

- Add ⌘K/Ctrl+K command palette search for components, examples, tokens, and pages
- Add component thumbnail images to ComponentsGrid
- Search features: filter commands (/c, /e, /t, /g), history, keyboard navigation
@twjeffery twjeffery force-pushed the tom/docs-search-feature branch from de8e566 to 94257e1 Compare March 5, 2026 01:19
@twjeffery
Copy link
Copy Markdown
Collaborator Author

@twjeffery you will need to rebase to get the failing calendar test fix

done

@chrisolsen
Copy link
Copy Markdown
Collaborator

@ArakTaiRoth it was failing the test, so it wasn't ready to be merged

@chrisolsen chrisolsen merged commit 00a015d into dev Mar 5, 2026
8 of 9 checks passed
@chrisolsen chrisolsen deleted the tom/docs-search-feature branch March 5, 2026 01:38
@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.41.0-dev.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.11.0-dev.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.11.0-dev.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.11.0-dev.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 7.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 5.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen chrisolsen added the released Released into production. label Apr 1, 2026
@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Create site-wide search with facets and synonyms (WIP)

3 participants