Feature/forward arrow key autocomplete - #81
Merged
Conversation
added 4 commits
April 12, 2016 18:04
-- Added desired behaviour
-- Handled case where there was no search suggestion
…sted terms in SearchBar -- Added up down arrow key behaviour. Need to do some more testing and cleanup
…sted terms in SearchBar -- Fixed lint errors
Author
|
@nlitwin Please let me know what do you think about the two features added through this PR and any code improvement that I can make. |
Author
|
Merging for now, but happy to do any change required to improve the feature or the code. You can see the live changes on any legacy page of topcoder-dev.com. |
| this.search() | ||
| }) | ||
| } else if (eventKey === 39) { // right arrow key is pressed | ||
| const suggestion = this.state.suggestions.length > 0 ? this.state.suggestions[0] : null |
Contributor
There was a problem hiding this comment.
I think const suggestion = this.state.suggestions[0] would work too
Author
There was a problem hiding this comment.
I guess yes because that would assign undefined if suggestions array does not have any element in it and if (suggestion) would not evaluate to true in both cases, undefined and null
Author
There was a problem hiding this comment.
Just to close the thread, change is done in dev.
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.
AS#111383418066580, Autocomplete the search text on forward arrow key
AS#111383418066583, Support arrow navigation for moving between suggested terms in SearchBar
@nlitwin @parthshah fyi