fix: extract mobile search into separate component to prevent focus loss on keystroke#555
Open
saurabhhhcodes wants to merge 1 commit into
Open
fix: extract mobile search into separate component to prevent focus loss on keystroke#555saurabhhhcodes wants to merge 1 commit into
saurabhhhcodes wants to merge 1 commit into
Conversation
…oss on keystroke The search input inside the Navbar lost focus after typing the first character on mobile because the parent re-rendered on every state change. Extracted MobileSearch into its own component with isolated state so keystrokes no longer trigger a Navbar-wide re-render.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 16, 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.
Description
The mobile search input in the Navbar lost focus after typing the first character because the parent component re-rendered on every
setSearchQuerycall. Extracted the mobile search overlay into a standaloneMobileSearchcomponent with its own local state, so typing no longer triggers a Navbar-wide re-render.Changes:
src/components/ui/MobileSearch.jsx— self-contained mobile search with its own query state, results dropdown, and navigation handlersNavbar.jsx— replaced inline mobile search markup withMobileSearchcomponentFixes #554
GSSoC