question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
lucaGazzolacommented, May 7, 2019

Is there a plan of fixing this behaviour in upcoming releases? Testing iOS applications using appium is hell atm

0reactions
ZacMilanocommented, May 17, 2019

This issue persists for me on 58.6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessibility - React Native
Create mobile apps accessible to assistive technology with React Native's suite of APIs designed to work with Android and iOS.
Read more >
Is ReactNative's `accessibilityLabel` and iOS Label retrieved ...
We are planning to rely heavily on accessibilityLabel in ReactNative for Appium /webdriverIO driven automated tests. Will it be sustainable?
Read more >
Accessibility - React
Web accessibility (also referred to as a11y) is the design and creation of websites that can be used by everyone. Accessibility support is...
Read more >
An end to the abuse of Accessibility IDs - DEV Community ‍ ‍
As of React Native 0.64, we can and should change the standard way of ... translated accessibilityLabel="Login" // What's read out loud to ......
Read more >
Changelog | PSPDFKit for iOS
Fixes an issue where note annotation would be created on a wrong page in double page mode ... Improves compatibility with the React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found