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

onClick on children of is OutsideClickHandler prevented #44

Open
LukaszGrela opened this issue Sep 4, 2020 · 5 comments
Open

onClick on children of is OutsideClickHandler prevented #44

LukaszGrela opened this issue Sep 4, 2020 · 5 comments

Comments

@LukaszGrela
Copy link

I have wrapped some components with OutsideClickHandler the onOutsideClick works but I've noticed that none of my onClick handlers are working. It should not stop interaction on children of OutsideClickHandler.

@ljharb
Copy link
Collaborator

ljharb commented Sep 4, 2020

Can you share some code?

@Karthick-FK
Copy link

Karthick-FK commented Jan 21, 2021

@ljharb if i click any options inside a dropdown (react-select in my case) - My options wil have input type checkbox with respective label . . At that time, those options are not clickable. .

i tried with event.stopPropagation & immediatePropagation() inside the outsideClick event handler. That is not working

@ljharb
Copy link
Collaborator

ljharb commented Jan 21, 2021

@Karthick-FK can you make a codesandbox that repros the issue?

@Karthick-FK
Copy link

Karthick-FK commented Jan 23, 2021

@ljharb I have found out the reason for the issue.

i have configured a custom option (check box wit label) for my react-selct. If i remove this option:option from my components attribute , it is working fine. .

<Select onChange={onChangeHandler}> --> on change event not triggered when using custom option in my case.

components={{
IndicatorSeparator: () => null,
MultiValueRemove: () => null,
MultiValueContainer: multiValueContainer,
Option: option,
DropdownIndicator: dropdownIndicator
}}

const option = (props: any) => {
return (
<components.Option {...props}>
<input
style={{ marginRight: "6px" }}
type="checkbox"
checked={props.isSelected}
onChange={() => {}}
/>
{props.data.label}
</components.Option>
)
}

I will try to fix or set up a code sandbox and update here

@Karthick-FK
Copy link

Karthick-FK commented Jan 23, 2021

@ljharb On my further analysis , am not able to replicate this in code sandbox.

https://codesandbox.io/s/proud-moon-ekcze?file=/src/index.js

Also, i used the same select in my other screen. I introduced outside click handler in that screen and checked. But i can able to select the custom option in that screen.

I assume there will be some css issue (grid, flex) or z-index issue. But still no luck. Will update if i find anything.

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

No branches or pull requests

3 participants