Skip to content

Commit dcc4006

Browse files
AlanCezarAraujojasonLaster
authored andcommitted
* Fix issue firefox-devtools#2267 * Fixed lint error * [WIP] Fix 2267 * Fix lint * Fix firefox-devtools#2267 * Fix Flow lint errors * Fix lint errors * Fixed js lint errors * Removed index parameter from selectResultItem
1 parent bbf0736 commit dcc4006

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/components/Editor/SearchBar.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ const SearchInput = createFactory(require("../shared/SearchInput").default);
3030
const ResultList = createFactory(require("../shared/ResultList").default);
3131
const ImPropTypes = require("react-immutable-proptypes");
3232

33-
import type { FormattedSymbolDeclaration } from "../../utils/parser/utils";
33+
import type {
34+
FormattedSymbolDeclaration,
35+
SymbolDeclaration,
36+
} from "../../utils/parser/utils";
3437

3538
function getShortcuts() {
3639
const searchAgainKey = L10N.getStr("sourceSearch.search.again.key");
@@ -399,12 +402,15 @@ const SearchBar = React.createClass({
399402
},
400403

401404
// Handlers
402-
selectResultItem(item: FormattedSymbolDeclaration) {
405+
selectResultItem(e: SyntheticEvent, item: SymbolDeclaration) {
403406
const { selectSource, selectedSource } = this.props;
407+
404408
if (selectedSource) {
405409
selectSource(selectedSource.get("id"), {
406410
line: item.location.start.line,
407411
});
412+
413+
this.closeSearch(e);
408414
}
409415
},
410416

@@ -455,7 +461,7 @@ const SearchBar = React.createClass({
455461
e.preventDefault();
456462
} else if (e.key === "Enter") {
457463
if (searchResults.length) {
458-
this.selectResultItem(searchResults[this.state.selectedResultIndex]);
464+
this.selectResultItem(e, searchResults[this.state.selectedResultIndex]);
459465
}
460466
this.closeSearch(e);
461467
e.preventDefault();

src/components/shared/ResultList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const ResultList = createClass({
3030
renderListItem(item: ResultListItem, index: number) {
3131
return dom.li(
3232
{
33-
onClick: () => this.props.selectItem(item),
33+
onClick: event => this.props.selectItem(event, item, index),
3434
key: `${item.id}${item.value}${index}`,
3535
ref: index,
3636
title: item.value,

0 commit comments

Comments
 (0)