Instances of custom UIControl subclasses by default have accessibilityLabel generated out of private NSString ivars
| Originator: | argentumko | ||
| Number: | rdar://21813162 | Date Originated: | 14-Jul-2015 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 7 – iOS 9 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: If an iOS application defines a custom direct UIControl subclass which has NSString ivars, instances of this subclass will have an implicit accessibility label generated by Accessibility framework from values of these NSString ivars, unless "accessibilityLabel" property is overridden or a value is assigned to it explicitly. This can be undesirable, since there's no way to tell whether these NSString ivars hold a user-facing value, or they're internal implementation details. Framework shouldn't try inspecting private ivars in attempt to extract some information for the user, especially in case of accessibility. Steps to Reproduce: 1. Create a new iOS app project. 2. Create a class that inherits directly from UIControl, e.g. "MyCustomControl". 3. In MyCustomControl class, define ivar-backed properties "prop1" and "prop2" of class NSString. These can be public or private to the implementation. 4. Somewhere in the app, instantiate MyCustomControl and assign values to these properties like this: control.prop1 = @"Value1"; control.prop2 = @"Value2"; 5. Open iOS Simulator and enable Accessibility Inspector, or enable VoiceOver on iOS device. 6. Launch the app. Read the value of that MyCustomControl object's accessibilityLabel – whether in code, in debugger, using VoiceOver or Accessibility Inspector. Expected Results: Accessibility label should be empty as it was not defined by developer. Actual Results: Accessibility label is actually this: "Value1, Value2", as Accessibility framework derived it implicitly from NSString properties of the control. Version: Reproducible on all versions of iOS 7, iOS 8 and iOS 9 Seed 2 Notes: The attached archive contains an iOS app project which reproduces this issue. Make sure to enable VoiceOver or Accessibility Inspector before launching the app. Configuration: Reproducible on iOS devices with VoiceOver enabled and iOS Simulator with Accessibility Inspector enabled. Attachments: (Project from https://github.com/vlas-voloshin/ControlAccessibilityDemo was attached to the report)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!