Repository navigation
feat(ui): add SearchInput with clear button and Escape-to-clear (#377) - #418
Merged
Merged
Conversation
…icky1#377) Controlled search field built on Input. Shows an "X" clear button only when the query is non-empty; clicking it or pressing Escape resets the query. Escape on an empty field is left alone so parent handlers (modals, palettes) still receive it.
The input's backdrop-blur creates a stacking context painted after the absolutely positioned icon wrappers, hiding leftIcon/rightIcon. Lift the wrappers with z-10 so SearchInput's search icon is visible.
|
@ZeroElemental is attempting to deploy a commit to the Vicky's projects Team on Vercel. A member of the Team first needs to authorize it. |
TheVicky1
approved these changes
Oct 6, 2026
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.
1. Related Issue
Closes #377
2. Summary of Changes
Adds a reusable
SearchInput(src/components/ui/search-input.tsx), exported fromsrc/components/ui/index.ts.value,onChange(value: string)) with a search icon.aria-label="Clear search") that appears only when the query isn't empty.Escaperesets the query to"".Escapewhen the field is already empty does nothing, so parent Escape handlers (modals, the command palette) still get the key.onKeyDown.Also contains a small fix to the shared
Inputcomponent (separate commit). The input'sbackdrop-blurcreates a stacking context that was painted over the absolutely positionedleftIcon/rightIconwrappers, so the icons were invisible. Addingz-10to the wrappers fixes it. No existing caller used these props, so nothing else changes visually.3. Motivation & Context
Gives search fields a quick, keyboard-friendly way to reset the query.
4. Implementation Details
Inputprimitive, with theSearch/Xicons fromlucide-react.type="search"and hides the browser's native cancel button, so there's only one clear control.tests/search-input.test.ts(node:testwith SSR markup; the component is stateless, so its handlers are called directly). The 7 tests cover:preventDefaultonKeyDownstill being calledonChange5. Testing & Local Validation
npm run lint— ESLint passed with 0 errorsnpx tsc --noEmit— TypeScript strict check passed with 0 errorsnpm test(ornode scratch/run-tests.mjs) — 67/67 suites passednpm run test:file -- search-input— 7/7 tests passednode scratch/secret-scan.mjs— Zero secrets or sensitive credentials detectednpm run build— Production build succeeded without errors6. UI & Visual Changes
375px), tablet (768px), and desktop (1280px+)docs/DESIGN_SYSTEM.md)7. Database & Security Impact
8. Documentation Impact
9. Contributor Quality Checklist
.env.localfiles are included in this PR.upstream/mainwith an appropriate prefix (e.g.,feat/,fix/,docs/,ui/).type(scope): description).git diffto ensure no stray files or debugging artifacts were committed.10. Reviewer Notes
The
Inputicon fix is a separate commit (fix(ui): keep Input icons above the blurred input background), so it can be dropped or split out if you'd prefer.