mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 23:49:03 +00:00
Mouse clicks on Search V2 results never send `docs_search_v2_result_clicked`; only Enter does. Since #51175, the result link's click handler sets `isPointerSelectRef`, so `SearchV2Result.handleSelect` returns early on a click before it reaches the event in `SearchV2Panel`. The event's definition in `telemetry-constants.ts` says it fires on click or keyboard selection. I moved the event to the top of `SearchV2Result.handleSelect`, before the pointer early-return. cmdk calls `onSelect` on every left click as well as on Enter, so one call tracks Enter, plain clicks, and modifier clicks (new tab), once each. Navigation is unchanged, and no event or property is renamed or removed. **Note:** middle-click opens fire `auxclick` instead of `click`, so they stay untracked. No other tracking in the repo listens for `auxclick`, and I kept it that way. ## To test Force Search V2 on the docs preview with `?docs-search-v2=search-v2-active`, then open search and type a query with the network tab open. Tested on the PR preview: - [x] Click a result: one `docs_search_v2_result_clicked` request with `resultPath` and `query`, the page navigates, and the dialog closes. - [x] Cmd/Ctrl-click a result: one event, the result opens in a new tab, and the dialog stays open. - [x] Arrow to a result and press Enter: one event, and the page navigates. - [x] Middle-click a result: no event, the result opens in a new tab. - [x] Type a query and press Escape: no `docs_search_v2_result_clicked`, only `docs_search_v2_closed`. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill (n/a: no docs content changed) ## Linear - fixes GROWTH-1331 --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>