Skip to content

Process responder events for touches whose target unmounted - #59522

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59519-responder-null-target
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59519-responder-null-target

Conversation

@lazerg

@lazerg lazerg commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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 #59519

Changelog:

[GENERAL] [FIXED] - Fix the responder not being released when a touch ends after its view unmounted

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.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

Visual regression

1 visual difference(s) at 2d382197e434. Visual differences need maintainer approval. Review the report, then apply visual-change-approved.

ios scroll-view/horizontal-scroll-to/end: Changed, 69504 px (18.123%)

diff

Expected and Captured
Expected Captured
expected captured

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taps are lost after a view unmounts during a touch (enableNativeEventTargetEventDispatching)

1 participant