Alter event replaying strategy for target only events #19300
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes four events from being included in event replaying. These events are:
submit
reset
close
cancel
submit
andreset
are both form events, and they also natively bubble on the browser. However, in React, we instead attach these to target element. We could change this in #19285, but as mentioned in that PR, there are quite a few codesites internally that rely on these events not being delegated, yet we need delegation to make event replaying work.close
andcancel
are related to using<dialog>
elements and don't natively bubble. The only way to make these work is to use the capture phase (which React's event system used to do), and emulate the bubbling. These events are rarely used and so these probably aren't too big of a deal.In both cases, we can re-add these events for event replaying in the future. @sebmarkbage has some ideas around how we can re-use the capture phase for event replaying, which will avoid the issues outlined above. However, for now, I feel we can get away with removing these events for replaying, to unblock the other streams of work (#19278).