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

Ignore elements with a blacklist #1

Open
danbovey opened this issue Sep 10, 2016 · 0 comments
Open

Ignore elements with a blacklist #1

danbovey opened this issue Sep 10, 2016 · 0 comments

Comments

@danbovey
Copy link
Owner

danbovey commented Sep 10, 2016

We could add to the config to make a list of elements to ignore, so that clicking a button located outside of the component which toggles the display, doesn't immediately toggle the display again.

However, the cleanest way of doing this is within the component's own handleClickOutside function, as your application will have knowledge/context of these elements whereas passing this logic to the HOC is pretty hacky.

handleClickOutside(e) {
    const blacklist = ['btn-modal', 'btn-modal-icon'];
    if(blacklist.indexOf(e.target.id) == -1) {
        this.props.actions.close();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant