Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Setting accessibilityLabel on Views is not working as expected

$
0
0

I have a Ti.UI.View which I am trying to set an accessibility label on. I'm setting the accessibility label as a property in my TSS file. When I try to see the accessibility label later, I cannot find it, although it appears to be working properly.

controller.xml

<Alloy>
    <View id="myView" />
</Alloy>
controller.tss
"#myView": {
    accessibilityLabel: "My label.",
    backgroundColor: "red"
}
controller.js
Ti.API.info("accessibilityLabel: " + $.myView.accessibilityLabel); //prints undefined
Ti.API.info("getAccessibilityLabel: " + $.myView.getAccessibilityLabel()); //prints undefined
Ti.API.info("backgroundColor: " + $.myView.backgroundColor); //prints "red"
When I turn on accessibility in the iOS device, the label appears to have worked - the voice over reads the label out to me. I'm using Appium and Selenium WebDriver to locate my view using the accessibility label (this works, although it's searching "by name" rather than accessibility label specifically, not sure why that is):
Context.Driver.FindElement(By.Name("My label."), 30)
I want to write a unit test that ensures that every Titanium object has accessibility options set, but I cannot do this because the getters do not seem to work as I expect. Has anyone encountered this issue before? Am I doing something wrong? I've looked at the view using JSON.stringify and it is not set there. I've looked at all of the other accessibility properties, and nothing is set there. I tried looking at the Titanium source on github but couldn't find any code that seemed to be doing anything strange.

I'm using Titanium SDK 3.5.1 and building on iOS 8.4.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>