Repository navigation
fix(app): select the source selector label on click so typing replaces it - #3696
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: f01065d The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Duplicate code analysis1 new clone introduced by this PR.
If one of these duplicates a helper that already exists, import it instead jscpd compared this branch against |
E2E Test Results✅ All tests passed • 467 passed • 1 skipped • 1093s
Tests ran across 4 shards in parallel. |
|
The jscpd clone ( |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the source-selector focus-selection change.
No open issues 🎉
What changed in this PR
Fixes source-selector typing so the click that focuses the input selects its current label, allowing typing to replace it rather than insert into it. A second click preserves normal caret placement.
Changes:
- Adds a focus-selection hook used only by the source selector.
- Adds unit tests for label replacement and second-click caret behavior.
- Includes an app patch changeset.
| File | Description |
|---|---|
packages/app/src/hooks/useSelectAllOnFocus.ts |
Adds focus and mouse handlers for selecting the current label. |
packages/app/src/components/SourceSelect.tsx |
Applies the hook to the searchable source selector. |
packages/app/src/components/__tests__/SourceSelect.test.tsx |
Tests replacement typing and normal second-click caret placement. |
.changeset/source-select-select-all-on-focus.md |
Records the source-selector fix for a patch release. |
Review effort: Balanced
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor None could be anchored to changed lines; they are listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. The select-all-on-focus hook is correct: the 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (5): correctness, testing, maintainability, kieran-typescript, julik-frontend-races. Prior PR comments were assessed from the fetched thread: the jscpd Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
f8855bb to
221a67b
Compare
Summary
The source selector is a searchable Mantine Select, and clicking it puts the caret wherever the pointer lands inside the current label. Typing
Data planeoverControlPlane LogsproducesControlData planePlane Logs, the dropdown filters to nothing, and the user has to clear the box by hand before every switch.This PR selects the whole label on the click that focuses the selector, so typing replaces it. A second click into an already focused selector places the caret as usual, and Escape or clicking away still restores the previous label. The handlers live in
useSelectAllOnFocusand onlySourceSelectControlleduses them, so the aggregation, database, table and filter dropdowns are unchanged. A unit test pins replace-on-click and the second-click caret.Screenshots or video
Not captured: this change was made without a browser. A short video of click-then-type on the source box shows it best.
How to reproduce
Starting point: https://play.hyperdx.io/search, or
yarn app:dev:localconnected to the demo server.On
main:tra.trainserted in the middle and the dropdown has no matching source.On this branch:
tra.traand the dropdown lists the sources whose name or section contains it.How to test on Vercel preview
Preview routes: /search
Steps:
tra.traand the dropdown lists at least one source whose name contains "Tra".References