Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility label is not reaching the function that is handling it on iOS #25220

Closed
LorandP opened this issue Jun 11, 2019 · 4 comments
Closed
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@LorandP
Copy link

LorandP commented Jun 11, 2019

Description

When adding an accessibilityLabel to a view, on iOS that accessibility label is not reaching the function that is handling the label.

We have discovered this issue while importing a .ipa into Appium Inspector which is an automation testing tool. There the accessibility labels get concatenated, you can see that in this screenshot:
https://ibb.co/Nxq4Cdh

On further inspection, I have found that on the native side, the functions that are handling the accessibility lables don't receive the accessibility labels set.

Other issues opened on this are:
appium/appium#10654
#21830

React Native version: 0.59.5

Steps To Reproduce

  1. Add some an accessibleLabel to a view
  2. Go to the following function located in:
    React -> Views -> RCTView -> (NSString *)accessibilityLabel
  3. When the flow of the application gets there, you will see that the function tries to return super.accessibilityLabel but every time that is nil
  4. The flow then goes into the RCTRecursiveAccessibilityLabel function which receives the self parameter from which then he tries to retrieve the subviews that contain the accessibilityLabels but there is no subview when the function gets to that point.

Describe what you expected to happen:
We expect that the (NSString *)accessibilityLabel function successfully retrieves the accessibilityLabel and returns it or else the RCTRecursiveAccessibilityLabel function receives the subviews for the current screen

Snack, code example, or link to a repository:

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

static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
{
  NSMutableString *str = [NSMutableString stringWithString:@""];
  for (UIView *subview in view.subviews) {
    NSString *label = subview.accessibilityLabel;
    if (!label) {
      label = RCTRecursiveAccessibilityLabel(subview);
    }
    if (label && label.length > 0) {
      if (str.length > 0) {
        [str appendString:@" "];
      }
      [str appendString:label];
    }
  }
  return str;
}
@LorandP LorandP added the Bug label Jun 11, 2019
@react-native-bot react-native-bot added the Platform: iOS iOS applications. label Jun 11, 2019
@a7urag
Copy link

a7urag commented Jul 22, 2019

any update on this?

@a7urag
Copy link

a7urag commented Jul 22, 2019

@stale
Copy link

stale bot commented Oct 20, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 20, 2019
@stale
Copy link

stale bot commented Oct 27, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Oct 27, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants