Skip to content

fix: deliver raw touch events past a declining touch responder - #1958

Merged
mdjastrzebski merged 1 commit into
callstack:mainfrom
RaphaelFakhri:fix/touch-events-ignore-responder
Nov 5, 2026
Merged

mdjastrzebski merged 1 commit into
callstack:mainfrom
RaphaelFakhri:fix/touch-events-ignore-responder

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Summary

Fixes #1957.

fireEvent(element, 'touchStart') skips the onTouchStart of an ancestor when the nearest touch responder below it declines the touch (onStartShouldSetResponder returns false). The same applies to touchMove, touchEnd and touchCancel. On a device, raw touch events are not part of responder negotiation: they reach every ancestor of the touched view whether or not a view accepts the responder. Libraries that attach onStartShouldSetResponder to a wrapper View in their Jest mocks, such as the hook gesture detector in React Native Gesture Handler 3, make every raw touch under them unreachable from ancestors.

isEventEnabled now returns true for raw touch events before it applies the responder check. The pointerEvents and non-editable TextInput checks run first and are unchanged. Responder-driven events like press still respect a declining responder, which the existing does not warn when the responder declines the touch test covers.

The change also adds a CHANGELOG.md entry under "Unreleased".

Test plan

  • New tests in src/events/__tests__/fire-event.test.tsx (responder system):
    • touchStart, touchMove, touchEnd and touchCancel reach a parent handler when the child declines the responder.
    • touchStart reaches the handler on the element that declines the responder.
  • Without the source change: yarn jest src/events/__tests__/fire-event.test.tsx -t "responder system" reports 5 failed, 2 passed. With it: 7 passed.
  • yarn test:ci: 87 suites, 954 tests passed.
  • yarn typecheck, yarn lint and yarn format:check pass.

@mdjastrzebski

Copy link
Copy Markdown
Member

Closing, as this issue will be properly addressed in the upcoming modern event system #1945 1945

@mdjastrzebski mdjastrzebski reopened this Nov 5, 2026
@mdjastrzebski
mdjastrzebski merged commit 564a842 into callstack:main Nov 5, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fireEvent doesn't deliver raw touch events to an ancestor when a view below declines the responder

2 participants