Honor skipBubbling in the new EventTarget-based event dispatch#56666
Closed
rubennorte wants to merge 1 commit intofacebook:mainfrom
Closed
Honor skipBubbling in the new EventTarget-based event dispatch#56666rubennorte wants to merge 1 commit intofacebook:mainfrom
rubennorte wants to merge 1 commit intofacebook:mainfrom
Conversation
Summary: The feature flag `enableNativeEventTargetEventDispatching` switches the React Native renderer from the legacy plugin-based event dispatch to a new W3C `EventTarget`-based dispatch in `dispatchNativeEvent.js`. The legacy path honors the `phasedRegistrationNames.skipBubbling` flag declared in view configs by short-circuiting the bubble traversal. The new path was unconditionally setting `bubbles: true` for any event with a `customBubblingEventTypes` entry, so `topPointerEnter` / `topPointerLeave` (the only events that declare `skipBubbling: true` today) ended up bubbling to all ancestors, breaking the W3C Pointer Events contract that `pointerenter` / `pointerleave` do not bubble. Map `skipBubbling: true` to `bubbles: false` on the synthesized `LegacySyntheticEvent`. The existing `EventTarget.dispatch()` bubble loop already short-circuits when `event.bubbles` is `false` and `target !== eventTarget`, so the target's own bubble + capture handlers still fire — only ancestor bubble handlers are suppressed. Capture-phase listeners are unaffected. Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D103200424
|
@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103200424. |
Collaborator
|
This pull request was successfully merged by @rubennorte in 3446958 When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in 3446958. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
The feature flag
enableNativeEventTargetEventDispatchingswitches the React Native renderer from the legacy plugin-based event dispatch to a new W3CEventTarget-based dispatch indispatchNativeEvent.js. The legacy path honors thephasedRegistrationNames.skipBubblingflag declared in view configs by short-circuiting the bubble traversal. The new path was unconditionally settingbubbles: truefor any event with acustomBubblingEventTypesentry, sotopPointerEnter/topPointerLeave(the only events that declareskipBubbling: truetoday) ended up bubbling to all ancestors, breaking the W3C Pointer Events contract thatpointerenter/pointerleavedo not bubble.Map
skipBubbling: truetobubbles: falseon the synthesizedLegacySyntheticEvent. The existingEventTarget.dispatch()bubble loop already short-circuits whenevent.bubblesisfalseandtarget !== eventTarget, so the target's own bubble + capture handlers still fire — only ancestor bubble handlers are suppressed. Capture-phase listeners are unaffected.Changelog: [internal]
Reviewed By: sammy-SC
Differential Revision: D103200424