Skip to content

feat(frontend): add debounced typeahead suggestions to search input#1237

Open
KiaraGrouwstra wants to merge 1 commit intomainfrom
type-ahead
Open

feat(frontend): add debounced typeahead suggestions to search input#1237
KiaraGrouwstra wants to merge 1 commit intomainfrom
type-ahead

Conversation

@KiaraGrouwstra
Copy link
Copy Markdown
Collaborator

Summary

  • New Search.Typeahead module: 150 ms debounced, stale-token drop, hits the existing *.edge ngram subfields with size: 8. Suggestions render as anchor links that navigate straight to the package/option detail.
  • Honors navigator.connection.saveData (and effectiveType in {slow-2g, 2g}) - the dropdown stays disabled on metered/slow connections and the page falls back to the original submit-on-enter UX.
  • Closes the dropdown on submit, Escape, and blur (200 ms grace so a click on a suggestion still navigates). Re-focusing the input re-shows cached suggestions.
  • The Flakes page keeps it disabled (its aggregate index is not channel-shaped).

No backend or mapping changes - reuses existing edge subfields. If ranking quality turns out to be poor we can follow up with a search_as_you_type field; that would require an index version bump.

Disclaimer: i used a coding agent in the creation of this patch.

Test plan

  • npm run prod builds clean.
  • Type into the Packages search bar - dropdown appears after pause, click navigates.
  • Same on the Options page - suggestions are options, not packages.
  • Press Enter / Escape / click outside - dropdown closes.
  • Refocus the input - cached dropdown re-appears.
  • Toggle Chrome DevTools "Slow 3G"/"Save-Data" - dropdown stays hidden.
  • Flakes page - no dropdown, behaves as before.

@KiaraGrouwstra KiaraGrouwstra requested a review from raboof April 27, 2026 21:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

@github-actions github-actions Bot temporarily deployed to pull request April 27, 2026 21:24 Inactive
Adds a per-keystroke dropdown that fires a small ES query (`size: 8`)
against the existing `*.edge` ngram subfields with a 150 ms debounce
and stale-token drop. Suggestions are anchor links; clicking
navigates to the package or option detail. The Flakes page leaves
the dropdown disabled (its index is not channel-shaped).

Honors `navigator.connection.saveData` and `effectiveType in
{slow-2g, 2g}` via a new flag — when set, the typeahead is disabled
and behavior matches the pre-change submit-on-enter UX.

Closes the dropdown on submit, Escape, and blur (with a 200 ms grace
period so a click on a suggestion still navigates). Re-focusing the
input re-shows cached suggestions.

HTML tags in description fields are stripped before display.
@github-actions github-actions Bot temporarily deployed to pull request April 27, 2026 21:37 Inactive
@raboof
Copy link
Copy Markdown
Member

raboof commented Apr 28, 2026

there seems to be an extra bulleted list under the search box that pops in and out of view?

@raboof
Copy link
Copy Markdown
Member

raboof commented Apr 30, 2026

While I think this is neat, I'm a bit concerned that this will seriously increate the load on our ES instance, which already seems to be struggling sometimes. What could we do to monitor/compensate for that?

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