Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #759 from caseychoiniere/develop
Browse files Browse the repository at this point in the history
Fix search filter checkbox ghostclick
  • Loading branch information
Donmurry authored Oct 31, 2017
2 parents 348eebb + 4682436 commit e840416
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/scripts/components/globalComponents/searchFilters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class SearchFilters extends React.Component {
let projects = searchResultsProjects.map((obj) => {
const projectPostFilter = obj.key;
let text = <span style={styles.checkbox.label}>{`${obj.key} `}<span style={styles.checkbox.count}>{` (${obj.doc_count})`}</span></span>;
return <ListItem key={obj.key}
onClick={() => mainStore.searchObjects(searchValue, null, projectPostFilter, null, null)}
return <ListItem key={obj.key} onClick={(e) => this.search(e, searchValue, null, projectPostFilter, null, null)}
primaryText={text}
leftCheckbox={<Checkbox style={styles.checkbox} checked={searchProjectsPostFilters['project.name'].includes(obj.key)} />}
style={styles.listItem}/>;
Expand All @@ -41,8 +40,7 @@ class SearchFilters extends React.Component {
let tags = searchResultsTags.map((obj) => {
const tagPostFilter = obj.key;
let text = <span style={styles.checkbox.label}>{`${obj.key} `}<span style={styles.checkbox.count}>{` (${obj.doc_count})`}</span></span>;
return <ListItem key={obj.key}
onClick={() => mainStore.searchObjects(searchValue, null, null, tagPostFilter, null)}
return <ListItem key={obj.key} onClick={(e) => this.search(e, searchValue, null, null, tagPostFilter, null)}
primaryText={text}
leftCheckbox={<Checkbox style={styles.checkbox} checked={searchTagsPostFilters['tags.label'].includes(obj.key)} />}
style={styles.listItem}/>;
Expand All @@ -55,13 +53,11 @@ class SearchFilters extends React.Component {
primaryTogglesNestedList={true}
onNestedListToggle={() => this.toggleNestedList('kindListToggleIcon')}
nestedItems={[
<ListItem key={BaseUtils.generateUniqueKey()}
onClick={() => mainStore.searchObjects(searchValue, Kind.DDS_FILE, null, null, null)}
<ListItem key={BaseUtils.generateUniqueKey()} onClick={(e) => this.search(e, searchValue, Kind.DDS_FILE, null, null, null)}
primaryText={<span style={styles.checkbox.label}>Files</span>}
leftCheckbox={<Checkbox style={styles.checkbox} disabled={!searchResultsFiles.length} checked={searchFilters.includes(Kind.DDS_FILE)} />}
style={styles.listItem}/>,
<ListItem key={BaseUtils.generateUniqueKey()}
onClick={() => mainStore.searchObjects(searchValue, Kind.DDS_FOLDER, null, null, null)}
<ListItem key={BaseUtils.generateUniqueKey()} onClick={(e) => this.search(e, searchValue, Kind.DDS_FOLDER, null, null, null)}
primaryText={<span style={styles.checkbox.label}>Folders</span>}
leftCheckbox={<Checkbox style={styles.checkbox} disabled={!searchResultsFolders.length} checked={searchFilters.includes(Kind.DDS_FOLDER)} />}
style={styles.listItem}/>
Expand Down Expand Up @@ -132,6 +128,11 @@ class SearchFilters extends React.Component {
);
}

search(e, arg1, arg2, arg3, arg4, arg5) {
e.preventDefault(); // Prevents ghostclick on listItem (https://github.com/callemall/material-ui/issues/5070)
mainStore.searchObjects(arg1, arg2, arg3, arg4, arg5);
}

clearFilters(searchValue) {
mainStore.resetSearchFilters();
mainStore.searchObjects(searchValue, null, null, null, null);
Expand Down

0 comments on commit e840416

Please sign in to comment.