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

Check that the document has element on clickaway #463

Merged
merged 1 commit into from
Apr 15, 2015
Merged

Check that the document has element on clickaway #463

merged 1 commit into from
Apr 15, 2015

Conversation

alexprice1
Copy link

This is for the click-away mixin. I have this click-away mixin for one of my components. In this component I am removing an element, and that element is being removed on click.

React removes this element before the event is bubbled up to click-away. I added 'document.contains(e.target)' to make sure the dom element is in the document prior to saying the user clicked away. This might want to be looked at some more...

@alexprice1
Copy link
Author

If this ever becomes an issue for anyone, we could remove this check, but when we call this.componentClickAway we could pass in e.target, that way the user can check if the document contains the element:

componentClickAway: function(target) {
if(document.contains(target) {
//continue
}
}

hai-cea added a commit that referenced this pull request Apr 15, 2015
Check that the document has element on clickaway
@hai-cea hai-cea merged commit b656b96 into mui:master Apr 15, 2015
@zannager zannager added the component: ClickAwayListener The React component label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ClickAwayListener The React component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants