Repository navigation
[0.88] Fix responder events when dispatching to unmounted components - #60467
Open
rubennorte wants to merge 3 commits into
Open
rubennorte wants to merge 3 commits into
rubennorte wants to merge 3 commits into
Conversation
) Summary: With `enableNativeEventTargetEventDispatching` on, a touch that ends after its view unmounted never reaches the responder, so the old responder sticks around and `trackedTouchCount` stays one too high, which drops the next tap. `processResponderEvent` already handles a null target, but `dispatchNativeEvent` only accepts a non-null one and would crash in `dispatchTrustedEvent` if it got null. It now takes `EventTarget | null` and returns right after the responder step when there is no target. The renderer's `dispatchEvent` (`ReactFabricEventEmitter.js` in react/react) still skips the call for a null target, so that guard has to go too before the bug is fully fixed, and this change needs to land first. Fixes react#59519 [GENERAL] [FIXED] - Fix the responder not being released when a touch ends after its view unmounted Pull Request resolved: react#59522 Test Plan: Added a Fantom test to `ResponderEventTarget-itest.js` that grants the responder, sends `topTouchEnd` with a null target through `dispatchNativeEvent`, and checks that the release fires and the next touch is granted again. I couldn't build the Fantom runner locally, so I also ran the null-target case as a throwaway Jest test: on `main` it throws `TypeError: Cannot read properties of null` from `dispatchTrustedEvent`, and it passes with this change. `flow check`, eslint and prettier are clean. Reviewed By: javache Differential Revision: D127796330 Pulled By: rubennorte fbshipit-source-id: 3c3547998b3b079a540e8cdf8e904ee95a855515 (cherry picked from commit f754dbd)
Summary: Regenerate the development, production, and profiling Fabric renderer bundles from React revision `dc9aed364252a34966f4f2c4a98272317fdddb60`. Native events whose view has unmounted now reach the responder system even when their event target is null. This renderer-only update retains React version `19.3.0` and leaves package metadata and dependency versions unchanged. Changelog: [General][Fixed] - Fix lost taps after a touched view unmounts when EventTarget event dispatching is enabled Reviewed By: javache Differential Revision: D127828293 Pull Request resolved: react#59546 (cherry picked from commit eb90a8d)
…act#59545) Summary: Remove the flag-dependent skip from the Fantom regression test for a touched view unmounting before its touch ends. Fabric now forwards native events with a null target, so both dispatch systems must release the stale responder and grant the next touch. Keep the existing `enableNativeEventTargetEventDispatching:*` test matrix and remove the unused feature-flag import and obsolete TODO. Changelog: [Internal] ___ landed-with-radar-review Differential Revision: D127828380 Pull Request resolved: react#59545 (cherry picked from commit eaf4c26)
rubennorte
force-pushed
the
0.88-backport-responder-unmounted-target
branch
from
December 2, 2026 11:34
45c30c5 to
d07aa3c
Compare
gabrieldonadel
approved these changes
Dec 2, 2026
Contributor
|
CI is red because of a previous commit on the release branch, this fixes it: |
Collaborator
|
@rubennorte Nico's fix for CI already landed; do you mind rebasing this PR? |
3 tasks
This branch has not been deployed
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:
Backport of the fix for reactwg/react-native-releases#1490 to
0.88-stable, as requested in reactwg/react-native-releases#1490 (comment).With EventTarget-based event dispatching (enabled by default in 0.88), events targeting an unmounted view were dropped before reaching the responder system. As a result, the responder was never released and the next tap was lost.
Commits, cherry-picked with
-x:0.88-stable,dispatchNativeEventpassestargetdirectly toprocessResponderEventanddispatchTrustedEvent, without theinternalTargetcast. That cast was added onmainin 652d501 (Use global DOM types in Fantom tests (#58569) #58569), which isn't on this branch. The resolution widenstargetto?EventTargetand returns early whentarget == null. It doesn't bring in the cast.0.88-stablematch this commit's parent exactly.Changelog:
[GENERAL] [FIXED] - Fix lost taps and stuck responders after a touched view unmounts when EventTarget event dispatching is enabled
Test Plan:
yarn flow check: no errorsyarn eslint/yarn prettier --checkon the changed files: cleanResponderEventTarget-itest.jsis skipped in OSS (isOSS ? describe.skip : describe), so I removed the skip locally (not committed) and ran:yarn fantom ResponderEventTarget-itest: 50/50 pass. The new test "releases the responder when the touched view unmounts before the touch ends" passes withenableNativeEventTargetEventDispatchingboth on and off.dispatchNativeEvent/responder/renderer changes reverted: the new test fails, and so does "dispatches responderTerminate on touch cancel" presumably because the stuck responder carries over into it.yarn fantom EventDispatching-itest: passes.