Skip to content

Wrong translation from react-native's accessibilityLabel to iOS name/label #21830

Description

@melchior-by

Environment

OS: macOS High Sierra 10.13.6
Node: 10.8.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: Xcode 10.0 Build version 10A255
Android Studio: 3.1 AI-173.4907809

Packages: (wanted => installed)
react: ^16.4.1 => 16.4.1
react-native: ^0.55.4 => 0.55.4

Description

When accessibilityLabel set to the element in react-native code it translates to the iOS name/label, but all parent element's name/label accumulate accessibilityLabel value of a child element.

In Appium inspector it's looks like:

<e1 name ='label 2 label 1'>
  <e2 name ='label 2'>
    <e3 name ='label 1'>
      <e4 name ='label 1'>

But in native code:

<e1>
  <e2 accessibilityLabel ='label 2'>
    <e3>
      <e4 accessibilityLabel ='label 1'>

It completely ruins all efforts to automate testing of iOS app built from react-native code.
I investigated this issue and found it appears from work of RCTRecursiveAccessibilityLabel() function, which called in RCTView.m file in this code:

- (NSString *)accessibilityLabel
{
  NSString *label = super.accessibilityLabel;
  if (label) {
    return label;
  }
  return RCTRecursiveAccessibilityLabel(self);
}

Change return RCTRecursiveAccessibilityLabel(self); to return nil; - fix this issue, so I suggest this code changes to be implemented.

Activity

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

    Platform: iOSiOS applications.Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions