fix(docs): polish Command-K search states#30
Open
vyctorbrzezowski wants to merge 1 commit into
Open
Conversation
a5fa6cd to
dc84716
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR polishes the docs Command-K search experience without changing authored docs content.
Ask Moltyavailable from the search footer, includingAsk Molty about <query>and the Command+Enter affordance.Details and decisions
Search lifecycle
Typing still uses a 240ms debounce before running Pagefind. Suggestions intentionally run immediately because they are explicit user actions.
The loading state now keeps the spinner node mounted while the user keeps typing, so its animation does not restart on every keystroke. The old header shimmer was removed because the spinner is the loading indicator.
Pagefind load failures are treated as transient. If the search bundle is unavailable during a preview rebuild, the next search retries the import instead of keeping
Search index unavailablecached for the rest of the browser session.Results behavior
Results are keyboard navigable with ArrowUp/ArrowDown and Enter. The active/hover state is neutral and uses the docs shell surface tokens rather than a brand-orange outline. Inactive rows stay flat; rounded treatment appears only on hover/focus/active.
Each result can show
category / sectionPagefind metadata. That metadata is generated by the docs-site build from the existing navigation structure, not fetched at search time, so it does not add runtime lookup latency.Empty, loading, and unavailable states
The initial empty state is compact and uses:
No-results uses
No matches for “query”plus the Command+Enter badge for asking Molty directly.The unavailable-index state remains available for local preview or transient Pagefind failures, but it no longer masks later successful loads in the same session.
Ask Molty integration
The footer stays visible while results scroll. When a query is present, it shows
Ask Molty about <query>with a subtle shimmer on the query term. Command+Enter closes search and opens Molty with the query.For unauthenticated users, the pending Molty question is stored only for the auth handoff and resumes only when the callback returns with
molty_resume=1. Empty Ask Molty actions clear stale pending questions so old localStorage state cannot reopen an unrelated prompt.Responsive behavior
Mobile and narrow layouts keep the search panel centered, use a 16px input font to avoid awkward oversized placeholder rendering, hide cramped shortcut affordances, and keep the footer visible without forcing the modal to occupy most of the viewport.
Screenshots
Desktop
Initial search state:
Loading state:
Results with hover/active state and fixed Molty footer:
No results state:
Search index unavailable state:
Ask Molty footer close-up:
Command-K header affordance close-up:
Tablet
Mobile
Initial centered search state:
Mobile results:
Verification
node --check scripts/docs-site/assets.mjsnode --check scripts/docs-site/build.mjsnode --check scripts/docs-site/smoke.mjsnode --check scripts/docs-site/visual-smoke.mjsnpm run docs:build:previewnode scripts/docs-site/search-index.mjsnpx pagefind --site dist/docs-site --output-path dist/docs-site/pagefindnode scripts/docs-site/pagefind-normalize.mjsnode --check dist/docs-site/assets/docs-site.jsgit diff --check origin/main..HEADNot run: full docs build/smoke over the complete docs corpus. This was intentionally kept to the 30-page preview build to avoid the full 11k-page docs build during this review.