Skip to content

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

Description

@jrmsayag

Describe the bug

fireEvent(element, 'touchStart') skips an ancestor's onTouchStart when the nearest touch responder below that ancestor declines the responder (onStartShouldSetResponder returns false). The same goes for touchMove and touchEnd.

On a device, raw touch events aren't part of the responder negotiation: they reach every ancestor's onTouchStart/onTouchMove/onTouchEnd, whether or not a view accepts the responder (verified on a device: RN 0.88.1, Android emulator, the same parent and child as below, with a tap and a drag). A test that checks a screen observing touches from above (to pause a timer while a finger is down, say) fails under Testing Library, even though the app works.

The rule comes from isEventEnabled, which applies the nearest responder's answer to every event type (src/events/is-enabled.ts at v14.1.0). It isn't new in 14: 13.3.3 has the same check in src/fire-event.ts.

We hit it with React Native Gesture Handler 3: its Jest stand-in for a hook gesture's detector is a View that receives the detector's onStartShouldSetResponder. So any raw touch fired under a GestureDetector stops reaching the ancestors (reported on their side as software-mansion/react-native-gesture-handler#4656).

Expected behavior

Raw touch events (touchStart, touchMove, touchEnd, touchCancel) reach every ancestor's handler, as on a device. The responder check would still apply to responder-driven events such as press and the responder* events.

Steps to Reproduce

Repro repo: https://github.com/jrmsayag/rntl-touch-bubbling-repro-demo (npm ci && npx jest)

import {fireEvent, render, screen} from '@testing-library/react-native';
import {View} from 'react-native';

it('a raw touchStart reaches the parent when the child declines the responder', async () => {
  const onTouchStart = jest.fn();
  await render(
    <View onTouchStart={onTouchStart}>
      <View testID="child" onStartShouldSetResponder={() => false} />
    </View>,
  );

  await fireEvent(screen.getByTestId('child'), 'touchStart');

  expect(onTouchStart).toHaveBeenCalledTimes(1); // fails: 0 calls
});

The same test without onStartShouldSetResponder on the child passes. The repo also shows the Gesture Handler 3 case: a hook gesture fails, while a builder-API gesture passes.

Screenshots

N/A

Versions

  npmPackages:
    @testing-library/react-native: 14.1.0 => 14.1.0
    react: 19.3.0 => 19.3.0
    react-native: 0.88.1 => 0.88.1
    test-renderer: 1.3.1 => 1.3.1

Jest 30.5.2 with @react-native/jest-preset 0.88.1.

Activity

  1. mdjastrzebski commented on Nov 5, 2026

    @mdjastrzebski
    Member

    @jrmsayag thanks for bringing this up. I am currently working on impklementing a modern event system for RNTL v14, which should provide much more realistic simulation of event system, including fix for the issue you mentioned.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions