Skip to content

docs: search UX improvements (Ask AI fallback + Enter key)#48

Open
rachaelrenk wants to merge 1 commit intomainfrom
docs/migration-ff/search-ux
Open

docs: search UX improvements (Ask AI fallback + Enter key)#48
rachaelrenk wants to merge 1 commit intomainfrom
docs/migration-ff/search-ux

Conversation

@rachaelrenk
Copy link
Copy Markdown
Contributor

Summary

Improve the search dialog UX with an "Ask AI instead" fallback for no-results and Enter key navigation to the first result.

Changes

src/components/CustomSidebar.astro

Added an inline script with two search dialog enhancements:

1. "Ask AI instead" button (B1 + B3)

  • Appears in the Pagefind search dialog whenever the no-results message is shown
  • Clicking it closes the search dialog and opens the Kapa AI chat
  • Uses MutationObserver to detect when Pagefind renders .pagefind-ui__message
  • Styled with the shared --warp-control-* chrome palette to match the search pill and Ask button
  • Automatically removed when results appear or the dialog closes

2. Enter key navigation (B5)

  • Pressing Enter when no specific result is focused navigates to the first search result link
  • Only triggers when the focused element is NOT inside a .pagefind-ui__result (avoids interfering with result-level keyboard nav)

Not addressed

Breadcrumbs in search results (B4) -- Pagefind indexes page titles and content but not breadcrumb/hierarchy metadata. Adding breadcrumbs would require a build-time Pagefind indexing plugin to inject sidebar path data, which is out of scope for this PR. Noted in the Notion tracking item.

Fuzzy search (B2) -- Pagefind uses stemming and prefix matching but does not support fuzzy matching. This is a platform limitation. The "Ask AI instead" fallback partially mitigates this by giving users an alternative when search doesn't find what they need.

Context

Part of the docs v2 bug bash follow-up work. Tracks to Notion item: Migration FF: search UX improvements.

Co-Authored-By: Oz oz-agent@warp.dev

Add two search dialog enhancements via inline script in
CustomSidebar.astro:

1. 'Ask AI instead' button: appears in the search dialog when
   Pagefind shows a no-results message. Clicking it closes the
   search dialog and opens the Kapa AI chat. Uses MutationObserver
   to detect Pagefind's state changes. Styled with the shared
   warp-control chrome palette.

2. Enter key navigation: pressing Enter when no specific result is
   focused navigates to the first search result. Pagefind's default
   UI doesn't handle this -- it only submits the search form.

Note: breadcrumbs in search results (B4) is not addressed here --
it requires a Pagefind build-time indexing plugin to inject
breadcrumb metadata, which is out of scope for this PR.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 8, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 8, 2026 10:39pm

Request Review

@rachaelrenk rachaelrenk self-assigned this May 8, 2026
Copy link
Copy Markdown
Collaborator

@hongyi-chen hongyi-chen left a comment

Choose a reason for hiding this comment

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

Some design feedback: I actually prefer Gitbook’s search UI here

A couple things I think we could borrow:

  1. Make “Ask AI” feel like a search result, not a standalone button.

Instead of a centered button, I think it should look more like the inline result rows. It could be a sticky option near the bottom of the search dialog, similar to Gitbook’s “Ask AI assistant” treatment

  1. Add clearer keyboard navigation states.
    In Gitbook’s search results, you can move through results with arrow keys and clearly see which result is selected. Pressing Enter then opens that page. I think we could do the same, but instead of showing a chevron on the right, we could show/highlight an Enter icon to make the keyboard interaction more obvious

  2. We can also improve the styling of the search results, but we can handle that in a separate PR!

Image image

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.

2 participants