Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EuiOutsideClickDetector to work when its nested inside itself #1039

Conversation

chandlerprall
Copy link
Contributor

Fixes #1037 by tracking all unique IDs of a bubbling event's encountered EuiOutsideClickDetectors. This prevents a wrapping outside click detector from interfering with any children detectors.

@chandlerprall chandlerprall requested a review from cjcenizal July 19, 2018 20:29
@@ -32,7 +32,7 @@ export class EuiOutsideClickDetector extends Component {
// virtual DOM and executes EuiClickDetector's onClick handler,
// stamping the id even though the event originates outside
// this component's reified DOM tree.
this.id = htmlIdGenerator();
this.id = htmlIdGenerator()();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious: What does the double parens do/mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's calling the function that htmlIdGenerator returns; The initial use of the function was incorrect here but worked for the detector's purposes for reasons. Calling htmlIdGenerator returns a function which can then be called with our without a prefix, and that returns a string value.

@chandlerprall
Copy link
Contributor Author

jenkins test this

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM! Didn't test locally.

@chandlerprall chandlerprall merged commit 8895722 into elastic:master Jul 19, 2018
@chandlerprall chandlerprall deleted the bug/1037-nested-outclick-click-detector-fighting branch July 19, 2018 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants