On Jul 18, 2006, at 7:29 PM, Ricky Sharp wrote:
I have a couple of custom controls that provide a custom handler for NSAccessibilityDescriptionAttribute. Part of the description that I build will be the control's title. The title can either come from the title attribute of the cell, or from a linked UI title element (set up in IB).
Typically the title attribute / description attribute is an either/or. I am guessing this is a case where the title text is not at all sufficient for accessibility purposes?
I've tried unsuccessfully in obtaining the title element. Here's what I did in my cell subclass:
id theTitleUIElement = [super accessibilityAttributeValue:NSAccessibilityTitleUIElementAttribute];
The code above should get back the title ui element, if one is set on the object.
Does Accessibility Inspector report that the cell does indeed have a title UI element after you hook it up in IB and run the app? If not, I'm wondering if perhaps IB has a problem adding title / link elements to custom views/cells. You might try to connect the two in code using -
accessibilitySetOverrideValue: forAttribute:(NSString *)attribute. Be sure to set the override value on the cell not the control, and to set the text view cell as the ui element value.
If you find it works using a manual "setOverrideValue" but not in IB, please file a bug against IB.
Workaround...It won't be the end of the world if I can't do this as I'll just always set up the cell's title attribute and never link to a static text item to serve as the title.
True, but the title UI element should work.
Furthermore, I've found it interesting that NSCell subclasses do not provide the NSAccessibilityTitleUIElementAttribute. However, NSActionCell subclasses do. I'll file a documentation enhancement request to beef up the "supported attributes" table to include NSActionCell as that's a common class to subclass:
Neither NSCell nor NSActionCell have the NSAccessibilityTitleUIElementAttribute by default. It is either by a subclass implementing and reporting that attribute (NSFormCell does this), or else an instance having that attribute value set by -accessibilitySetOverrideValue:forAttribute: that it would be set. I'm curious where you are seeing this distinction.
Thanks,
James