From 16458378d5a60618b7054a0094091352123d8c43 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Mon, 18 Mar 2019 13:47:43 -0600 Subject: [PATCH 1/2] Fix EuiComboBox's call to props.onBlur --- src/components/combo_box/combo_box.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/combo_box/combo_box.js b/src/components/combo_box/combo_box.js index 2efa74e7575..da0003aacb3 100644 --- a/src/components/combo_box/combo_box.js +++ b/src/components/combo_box/combo_box.js @@ -286,19 +286,20 @@ export class EuiComboBox extends Component { const focusedInInput = this.comboBox && this.comboBox.contains(e.relatedTarget); if (!focusedInOptionsList && !focusedInInput) { this.closeList(); - } - // If the user tabs away or changes focus to another element, take whatever input they've - // typed and convert it into a pill, to prevent the combo box from looking like a text input. - if (!this.hasActiveOption() && !focusedInInput && !focusedInOptionsList) { - this.addCustomOption(); + if (this.props.onBlur) { + this.props.onBlur(); + } + + // If the user tabs away or changes focus to another element, take whatever input they've + // typed and convert it into a pill, to prevent the combo box from looking like a text input. + if (!this.hasActiveOption()) { + this.addCustomOption(); + } } } onComboBoxBlur = () => { - if (this.props.onBlur) { - this.props.onBlur(); - } this.setState({ hasFocus: false }); } @@ -571,6 +572,7 @@ export class EuiComboBox extends Component { onChange, // eslint-disable-line no-unused-vars onSearchChange, // eslint-disable-line no-unused-vars async, // eslint-disable-line no-unused-vars + onBlur, // eslint-disable-line no-unused-vars isInvalid, rowHeight, isClearable, From 971c3e2417e428d64a226839e76649f0c158ff41 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Mon, 18 Mar 2019 14:19:02 -0600 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dae76687ed..313ae08905f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Adds missing type and fixes closure-scope problem for `SuperDatePicker`'s `onRefresh` callback ([#1732](https://github.com/elastic/eui/pull/1732)) - Changed `EuiBottomBar` to refer to the end of document ([#1727](https://github.com/elastic/eui/pull/1727)) +- Fixed `EuiComboBox`'s calls to its `onBlur` prop ([#1739](https://github.com/elastic/eui/pull/1739)) ## [`9.4.0`](https://github.com/elastic/eui/tree/v9.4.0)