Skip to content

Commit

Permalink
Pause EuiOutsideClickDetector in EuiPopover and EuiColorPicker (#…
Browse files Browse the repository at this point in the history
…1527)

* EuiOutsideClickDetector should be disabled when the target element is not yet rendered: EuiPopover, EuiColorPicker

* #1527 changelog entry

* update changelog version location
  • Loading branch information
thompsongl authored Feb 5, 2019
1 parent 4b5987c commit 27dc847
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- TypeScript are now formatted with Prettier ([#1529](https://github.com/elastic/eui/pull/1529))
- Updated `EuiPopover` and `EuiColorPicker` to pause `EuiOutsideClickDetector` in when not open ([#1527](https://github.com/elastic/eui/pull/1527))

## [`6.9.0`](https://github.com/elastic/eui/tree/v6.9.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
withTitle={true}
>
<EuiOutsideClickDetector
isDisabled={true}
onOutsideClick={[Function]}
>
<div
Expand Down
5 changes: 4 additions & 1 deletion src/components/color_picker/color_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export class EuiColorPicker extends Component {
const { color, className, showColorLabel } = this.props;
const classes = classNames('euiColorPicker', className);
return (
<EuiOutsideClickDetector onOutsideClick={this.closeColorSelector}>
<EuiOutsideClickDetector
isDisabled={!this.state.showColorSelector}
onOutsideClick={this.closeColorSelector}
>
<div
className={classes}
data-test-subj={this.props['data-test-subj']}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = `
popoverRef={[Function]}
>
<EuiOutsideClickDetector
isDisabled={false}
onOutsideClick={[Function]}
>
<div
Expand Down
5 changes: 4 additions & 1 deletion src/components/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ export class EuiPopover extends Component {
}

return (
<EuiOutsideClickDetector onOutsideClick={closePopover}>
<EuiOutsideClickDetector
isDisabled={!isOpen}
onOutsideClick={closePopover}
>
<div
className={classes}
onKeyDown={this.onKeyDown}
Expand Down

0 comments on commit 27dc847

Please sign in to comment.