Frontend system design · Design
Autocomplete / typeahead (system-level)
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
Design a reusable autocomplete component that product teams across the company will use for search, user pickers and address lookup.
Then
Follow-ups the interviewer asks next
- Popup inside an
overflow:hiddendialog: which layer closes on Escape? - A typing burst: when do requests fire (debounce vs throttle, min length, cancellation)?
- What a cached shorter query can and can't tell you.
- "Load more" on scroll while the query changes mid-scroll; then testing, SSR, and the phone on-screen keyboard.
The answer
What a strong answer covers
- API: controlled/uncontrolled
value, an asyncsource(query, {signal}),renderItem,onSelect,minChars,debounceMs,cachestrategy. - Architecture: input + popup (portal + layer manager) + list (virtualised) + a cache (LRU by normalised query; prefix reuse only for client-filterable sources).
- Race handling: AbortController plus a latest-request guard. Offset pages shift when ranking changes, so match responses to inputs.
- ARIA combobox,
aria-liveresult counts, IME composition handling, mobile viewport and keyboard.
The red pen
Common traps
Avoid:a fetch per keystroke; ignoring IME/composition events; mouse-only.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.