Skip to content

Commit

Permalink
šŸ›: Use onKeyDown in SearchBar to allow for simpler iteration of resulā€¦
Browse files Browse the repository at this point in the history
ā€¦ts (firefox-devtools#4533)

In the QuickOpenModal we found that using onKeyDown meant a user could hold up/down to traverse
their results more easily. In the searchbar holding enter does the same.

Closes firefox-devtools#2527
  • Loading branch information
wldcordeiro authored and jasonLaster committed Nov 16, 2017
1 parent a1877f4 commit a678afd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Editor/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class SearchBar extends Component<Props, State> {
return this.doSearch(e.target.value);
};

onKeyUp = (e: SyntheticKeyboardEvent<HTMLElement>) => {
onKeyDown = (e: SyntheticKeyboardEvent<HTMLElement>) => {
if (e.key !== "Enter" && e.key !== "F3") {
return;
}
Expand Down Expand Up @@ -288,7 +288,7 @@ class SearchBar extends Component<Props, State> {
placeholder={L10N.getStr("sourceSearch.search.placeholder")}
summaryMsg={this.buildSummaryMsg()}
onChange={this.onChange}
onKeyUp={this.onKeyUp}
onKeyDown={this.onKeyDown}
handleNext={e => this.traverseResults(e, false)}
handlePrev={e => this.traverseResults(e, true)}
handleClose={this.closeSearch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`SearchBar should render 1`] = `
handleNext={[Function]}
handlePrev={[Function]}
onChange={[Function]}
onKeyUp={[Function]}
onKeyDown={[Function]}
placeholder="Search in fileā€¦"
query=""
showErrorEmoji={true}
Expand Down

0 comments on commit a678afd

Please sign in to comment.