Skip to content

Commit

Permalink
Close singleSelection EuiComboBox select list when item is selected (#…
Browse files Browse the repository at this point in the history
…645)

* Close EuiComboBox select list when item is selected

* besure to clear search input to avoid leaving fragment

* update readme
  • Loading branch information
nreese authored Apr 11, 2018
1 parent b73d27c commit 64144da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Added `disabled` prop to `EuiComboBoxOption` ([#650](https://github.com/elastic/eui/pull/650))
- Added support for `<pre>` and `<code>` tags to `<EuiText>` ([#654](https://github.com/elastic/eui/pull/654))
- Added export of SASS theme variables in JSON format during compilation ([#642](https://github.com/elastic/eui/pull/642))
- Close `EuiComboBox` `singleSelection` options list when option is choosen ([#645](https://github.com/elastic/eui/pull/645))

## [`0.0.40`](https://github.com/elastic/eui/tree/v0.0.40)

Expand Down
7 changes: 7 additions & 0 deletions src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,14 @@ export class EuiComboBox extends Component {
onAddOption = (addedOption) => {
const { onChange, selectedOptions, singleSelection } = this.props;
onChange(singleSelection ? [addedOption] : selectedOptions.concat(addedOption));

this.clearSearchValue();

if (singleSelection) {
this.closeList();
return;
}

this.focusSearchInput();
};

Expand Down

0 comments on commit 64144da

Please sign in to comment.