Skip to content

iOS: button's inferred accessibilityLabel includes children with accessibilityElementsHidden #4655

Open

Description

@vincentborko

Description

On iOS, a gesture-handler button without an explicit accessibilityLabel builds its label from its subviews in RNGHRecursiveAccessibilityLabel (apple/RNGestureHandlerButton.mm, 3.3.0 lines 1536-1556, unchanged in 3.4.0). That function is described as "Vendored from RCTView.m", but it lacks the check React Native has in its own version:

// react-native 0.88, React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm:1506-1510
for (UIView *subview in view.subviews) {
  // Skip subviews that have accessibilityElementsHidden set to YES
  if (subview.accessibilityElementsHidden) {
    continue;
  }

So a child marked accessibilityElementsHidden is still read into the button's label. The common case is an icon font glyph (@expo/vector-icons renders a Text): the button's label then starts with a Private Use Area character, e.g. U+F01A5 (Material Community Icons crown) before "Get Pro", even though the icon has accessibilityElementsHidden. Inside a plain React Native View with accessible the same tree is labelled without the glyph.

Steps to reproduce

import { Pressable } from "react-native-gesture-handler";
import { Text } from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons";

<Pressable accessibilityRole="button" onPress={() => {}}>
  <MaterialCommunityIcons name="crown" size={20} accessibilityElementsHidden importantForAccessibility="no" />
  <Text>Get Pro</Text>
</Pressable>

Read the accessibility tree (Accessibility Inspector or XCUITest): the button's label is "󰆥 Get Pro" instead of "Get Pro".

Suggested fix

Add the same if (subview.accessibilityElementsHidden) continue; at the top of the loop in RNGHRecursiveAccessibilityLabel.

Versions

react-native-gesture-handler 3.3.0 (also checked 3.4.0 source), react-native 0.88.0, Expo, New Architecture, iOS 26.
Observed on a device build (iPhone 16 Pro) in the accessibility tree; root cause read in source.

Activity

  1. github-actions commented on Oct 29, 2026

    @github-actions

    Hey @vincentborko! 👋

    Some of the required information in this issue is missing, incomplete or invalid. Could you take another look at the template and make sure each of these is filled in with something we can act on?

    • Description - what happens, and what you expected to happen instead
    • Steps to reproduce - steps somebody else can follow, not just numbering
    • Gesture Handler version - the exact version from your package.json or lockfile
    • React Native version - the exact version from your package.json or lockfile
    • Versions of related libraries you mention (Reanimated, Worklets, Screens, Expo) - the versions actually installed
    • Platforms - the platforms you actually see the bug on

    Once the issue is updated we will take another look. Thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions