Adding navigation button to Search Input. - #2463
Conversation
92452f1 to
cb1ce04
Compare
| Svg("arrow-up", { | ||
| className: classnames("nav-btn", "prev"), | ||
| onClick: handlePrev, | ||
| title: "Previous Result", |
There was a problem hiding this comment.
Could put these in L10N.
Codecov Report
@@ Coverage Diff @@
## master #2463 +/- ##
=======================================
Coverage 54.07% 54.07%
=======================================
Files 51 51
Lines 1986 1986
Branches 398 398
=======================================
Hits 1074 1074
Misses 912 912Continue to review full report at Codecov.
|
jasonLaster
left a comment
There was a problem hiding this comment.
Thanks for picking this up.
One highlevel point, I think next/prev makes more sense for text search and less sense for project and function search which are list based. The rationale is that scrolling through a list is very efficient, whereas jumping to the next item in a file can be trickier.
| } | ||
| this.setState({ selectedResultIndex: nextResultIndex }); | ||
| this.onSelectResultItem(searchResults[nextResultIndex]); | ||
| } |
There was a problem hiding this comment.
Hmm - I'm a bit confused by this logic.
It looks very similar to what we're doing in search search to determine the next index. Is there an easy way we can unify it?
| nextResultIndex = 0; | ||
| } | ||
| this.setState({ selectedResultIndex: nextResultIndex }); | ||
| this.onSelectResultItem(searchResults[nextResultIndex]); |
There was a problem hiding this comment.
This looks like it can be shared too...
| title: "Previous Result", | ||
| }) | ||
| ); | ||
| }, |
There was a problem hiding this comment.
SearchInput could be a good component to snapshot test:
https://facebook.github.io/jest/docs/snapshot-testing.html#content
| className: classnames("nav-btn", "next"), | ||
| onClick: handleNext, | ||
| title: "Next Result", | ||
| }), |
There was a problem hiding this comment.
what's our preference with wrapping - next at the end and previous at 0?
cb1ce04 to
031d644
Compare
|
This looks much better, I'll review soon! |
031d644 to
27afe5f
Compare
ee36e2f to
fd94386
Compare
jasonLaster
left a comment
There was a problem hiding this comment.
Made some small tweaks, but lets land this and we can always polish later!
|
Working on a rebase/polish commit now. Hopefully will push today (vacation is slowing me down 😆) |
|
Hehe. Thanks. I was so close to getting this in yesterday!
…On Wed, Apr 5, 2017 at 6:32 PM Wellington Cordeiro ***@***.***> wrote:
Working on a rebase/polish commit now. Hopefully will push today (vacation
is slowing me down 😆)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2463 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPiYvziquNHGIgN-sqoPpNr2-PrVaNmks5rtBZjgaJpZM4Mp7Ry>
.
|
fd94386 to
382c149
Compare
jasonLaster
left a comment
There was a problem hiding this comment.
Thanks. Looking better
| onChange: this.onChange, | ||
| onKeyUp: this.onKeyUp, | ||
| onKeyDown: this.onKeyDown, | ||
| handleNext: e => |
There was a problem hiding this comment.
hmm, not sure if we need the ternary. if we're not rendering the buttons will these be used?
| } | ||
|
|
||
| renderNav() { | ||
| const { count, handleNext, handlePrev } = this.props; |
There was a problem hiding this comment.
lets put the feature flag here
There was a problem hiding this comment.
Oh yeah, forgot to feature flag it. 😆
|
Wow that looks great, thanks for adding this and all your work to make it so nice |
|
Thanks @nadavoran for getting this started! |
* Adding navigation button to Search Input. re firefox-devtools#2387 * Only show search navigation for file text search. * Reduce some redundancy in SearchBar for traversing results. * Feature flag the search navigation buttons and remove redundant ternary.


Associated Issue: #2387
The previous PR was made against master and github got confused and closed it when I rebased. I'm reopening on behalf of @nadavoran with some tweaks and fixes to pass CI.
Summary of Changes
Test Plan
Screenshots/Videos