feat: add click-outside handler to SearchBar dropdown#2716
feat: add click-outside handler to SearchBar dropdown#2716hardikagarwal23 wants to merge 1 commit intocodervivek5:mainfrom
Conversation
|
@hardikagarwal23 is attempting to deploy a commit to the Vivek Prajapati's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughEnhanced the SearchBar component with ref management, outside-click detection, and dropdown result rendering. The component now intelligently closes the results list when users click outside and provides unified event handling while maintaining the existing public API. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Improve the SearchBar UX by adding click‑outside behavior for the suggestions dropdown and refining the focus visuals.
Changes proposed
Screenshots
Before:


Focus shadow/outline appeared on input click
After:
Clean focus state without outline
Note to reviewers
Scope: Applies to the SearchBar used in the User Navbar.
Non‑goal: Other SearchBars (Home/Dashboard/Admin) are separate components and unchanged.
Follow‑up: We can consolidate SearchBars into a single shared component in a separate PR for uniform behavior.
Summary by CodeRabbit
New Features
Style