Skip to content

Commit

Permalink
EuiComboBox in FireFox should close list on dropdown arrow click (#1885)
Browse files Browse the repository at this point in the history
* use explicitOriginalTarget in firefox

* #1885 CL entry
  • Loading branch information
thompsongl authored Apr 25, 2019
1 parent 35f9bf0 commit 0c6f4f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fixed type definitions around `EuiI18n`'s `default` prop to better support use cases ([#1861](https://github.com/elastic/eui/pull/1861))
- Localized `EuiTablePagination`'s row count selection ([#1883](https://github.com/elastic/eui/pull/1883))
- Fixed `EuiComboBox` with `singleSelection` and `onAddCustomOption` reopening the options list after adding a custom option ([#1882](https://github.com/elastic/eui/pull/1882))
- Fixed `EuiComboBox` reopening the options list in Firefox when closing via the dropdown arrow button ([#1885](https://github.com/elastic/eui/pull/1885))

## [`10.1.0`](https://github.com/elastic/eui/tree/v10.1.0)

Expand Down
7 changes: 5 additions & 2 deletions src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@ export class EuiComboBox extends Component {

onContainerBlur = (e) => {
// close the options list, unless the use clicked on an option
const focusedInOptionsList = this.optionsList && this.optionsList.contains(e.relatedTarget);
const focusedInInput = this.comboBox && this.comboBox.contains(e.relatedTarget);

// FireFox returns `relatedTarget` as `null` for security reasons, but provides a proprietary `explicitOriginalTarget`
const relatedTarget = e.relatedTarget || e.explicitOriginalTarget;
const focusedInOptionsList = relatedTarget && this.optionsList && this.optionsList.contains(relatedTarget);
const focusedInInput = relatedTarget && this.comboBox && this.comboBox.contains(relatedTarget);
if (!focusedInOptionsList && !focusedInInput) {
this.closeList();

Expand Down

0 comments on commit 0c6f4f6

Please sign in to comment.