-
Notifications
You must be signed in to change notification settings - Fork 47k
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
stopImmediatePropagation is not available for synthetic events #11547
Comments
I think sIP method on the Synthetic even would just prozy to |
Could you please provide me with an example that demonstrates this? |
@gaearon , I have a similar problem. I use event.nativeEvent.stopImmediatePropagation() to prevent the rootClose event (react bootstrap) on a popover that has a dropdown. But in my tests I have the following error: e.nativeEvent.stopImmediatePropagation is not a function there is even a solution, but there are many tests to replicate such a solution. the error is caused basically by the click simulation. I think if I had a synthetic event for the same it would be interesting. Note: My popover is customized over the popup of the react bootstrap and also the dropdown (which renders the items in the body of the document) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Can we this get reopened? |
What is your problem with the issue, @Bosch-Eli-Black ? |
@mensonones For me, it was nothing special. I just tried to call |
I concur with the above. The documentation for SyntheticEvent states:
Not having |
If this won't be fixed, at least fix the docs to stop claiming that the interface is the same when it's not. |
Please, correct me if I'm wrong, but it seems that the biggest problem here is that native events aren't actually attached to the individual elements, but rather to the root document. You can see this by comparing
When you do ReactDOM will pass the synthetic events down to the individual handlers you attached to React elements. So, calling If that's correct, |
That's true enough, but in our case we fully understood that and that's exactly what we wanted (for reasons that are too specific to be worth elaborating, but it involved avoiding a refactor in the short term). We still suffered from misleading documentation even though we mostly understood the consequences of what we were trying to do. |
I think @Mr-Wallet is right here. It was a big surprise when I've found my answers on StackOverflow, not the official docs. |
In order to call this method, you'd have to access it via
event.nativeEvent.stopImmediatePropagation()
: https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagationIt'd be awesome if this was supported on
event
itself. I did see a prior issue for this, but it was for a use case that sIP wasn't required for.For a specific use case: if you want to kill hover events for touch input,
onTouchStart
will triggeronMouseOver
andstopImmediatePropagation
cancels that internal cascade.The text was updated successfully, but these errors were encountered: