feat: add keyboard event support to SearchBar#1425
feat: add keyboard event support to SearchBar#1425AasthathecoderX wants to merge 5 commits intolayer5io:masterfrom
Conversation
Signed-off-by: AasthathecoderX <bhat.aasthaa@gmail.com>
|
The below are the videos showing the working:: enter_working.mp4Tab_working.mp4up_downworking.mp4spacebar_working.mp4 |
There was a problem hiding this comment.
Code Review
This pull request introduces an onKeyDown prop to the SearchBar and StyledSearchBar components, enabling custom keyboard event handling and search execution via the 'Enter' key. Feedback focuses on enhancing the handleKeyDown logic to respect event.defaultPrevented, cleaning up redundant comments, and fixing indentation inconsistencies to maintain code quality.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Rajesh Nagarajan <139469505+Rajesh-Nagarajan-11@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Rajesh Nagarajan <139469505+Rajesh-Nagarajan-11@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: AasthathecoderX <bhat.aasthaa@gmail.com>
miacycle
left a comment
There was a problem hiding this comment.
One thing worth tightening here: pressing Enter can trigger onSearch twice. handleSearchChange already schedules the debounced search, and if Enter is pressed before that debounce expires, handleKeyDown calls onSearch(searchText) immediately while the pending debounced call still fires shortly after. Please cancel the pending debounced callback before the immediate Enter-path search (or funnel Enter through the same search path) so consumers do not get duplicate requests or state updates.
ok @miacycle ,I will look into it |
Notes for Reviewers
This PR fixes #718
Signed commits