fix: suggest popular courses on empty homepage search focus - #512
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
fix: suggest popular courses on empty homepage search focus#512posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
Focusing the empty homepage course search rendered nothing: `dropdownVisible`
required a non-empty query and `onFocus` only opened the dropdown when the query
was already non-empty, so clicking the bar to see what's searchable was a silent
no-op (session replay shows users idling and abandoning search).
- Open the dropdown on focus and preview the most content-rich courses ("Popular
courses") when the field is empty, so the bar always surfaces something and
teaches people what a valid query looks like. The suggestion list reuses the
already paper/note-ranked `courses` prop and is fully keyboard-navigable.
- Fire a `course_search_focused` event on focus-without-typing so this dead-end
stops being replay-only.
- Add an `NLP` alias mapping to the real catalog course BCSE409L (Natural
Language Processing), which previously dead-ended.
paths: app/(app)/home/course-search.tsx lib/course-map.ts lib/posthog/client.ts
Generated-By: PostHog Code
Task-Id: 5142b8aa-ded2-4806-9b2d-772e4fea0ea2
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
019fc1f2) shows one clicking the empty bar 3× in 2.4s with zero visual response, idling 3m40s, then abandoning search for nav browsing.dropdownVisiblerequiredquery.trim().length > 0and the input'sonFocusonly calledsetIsOpen(true)when a query was already typed, so an empty, focused field rendered nothing.NLPdead-ended even though the course exists in the catalog.Changes
coursesprop (getSearchableCourses), is keyboard-navigable, and prefetches the top rows.course_search_focused(withsuggestion_count) once per visit when someone focuses without typing, so the dead-end is measurable.NLP→BCSE409L(Natural Language Processing) toCOURSE_ACRONYMS.Why
Search entry is the homepage's primary path and both signals showed it dead-ending:
course_search_no_resultslogged ~60 distinct failing queries on Aug 1–2, and replay caught users clicking the empty bar to no effect and giving up.Scope notes
MCA,msc,bba,PAMCA503) point at programs whose courses aren't in the catalog —PAMCA503itself returned no results because that code isn't ingested. Aliases can only surface courses that exist, so pointing them at absent codes would do nothing;NLPis the one named acronym that maps to a real course. Surfacing MCA/BBA/MSc content is a catalog-ingestion task, not a search-UX one.Verification
The dev environment here has no installed dependencies or database, so this was verified by code-path analysis against the described replay rather than a live run: on empty focus
onFocusnow setsisOpenanddropdownVisibleis true because the suggestion list is non-empty, so the bar renders the "Popular courses" list instead of nothing — directly changing the observed state in019fc1f2. Worth a quick manual pass on a full dev environment before merge.Created with PostHog Desktop from this inbox report.