-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Experimental Event API: adds stopPropagation
by default to Press
#15384
Conversation
ReactDOM: size: -0.0%, gzip: -0.0% Details of bundled changes.Comparing: a9eff32...965ec07 react-dom
react-events
Generated by 🚫 dangerJS |
@@ -477,6 +539,38 @@ describe('Event responder: Press', () => { | |||
expect(onLongPress).not.toBeCalled(); | |||
}); | |||
|
|||
it('is called but does not bubble', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's perform all the bubbling tests in the "nested responders" block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to remove the nested responders block, as I thought it would be best to be about type of event. :/ I don't mind though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. But it seems we could test the bubbling/not-bubbling for all events in a single test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this in a follow up tomorrow, will need some re-organizing of the test file. I also want to add some more test coverage for Press too :)
I want to get this in for now, so at least we have proper propagation stopping support.
This PR adds the default behaviour of stopping propagation on Press events, with the ability to override that feature using the
stopPropagation
prop. I also had to refactor the event propagation system to account for async event contexts, which means aligningcontext.setTimeout
withcontext.clearTimeout
so we can share actual timeouts where they have matching delays within the same context.