I have a button, that when pressed, shows a "helper" window.
This window is shown, but not given keyboard focus, via orderFrontRegardless
.
The window contains an NSTextView
with helper text inside.
For vision-impaired users, I would like OS X's voiceover to immediately read the contents of this window's text view when it appears.
I am attempting to make VoiceOver read the text via:
NSAccessibilityPostNotification(textView, NSAccessibilityValueChangedNotification);
In my subclass of NSTextView
I then override the accessibility method:
- (id)accessibilityAttributeValue:(NSString *)attribute
{
//The notification calls this method for attributes:
//AXRole: returns AXTextArea
//AXSharedCharacterRange: returns range of the text view
return [super accessibilityAttributeValue:attribute];
}
The notification causes it to query for AXRole
(NSAccessibilityRoleAttribute
) and AXSharedCharacterRange
(NSAccessibilitySharedCharacterRangeAttribute
).
The character range correctly returns the range of the text area.
However, at no point is AXValue
(NSAccessibilityValueAttribute
) requested. That is that I am expecting is required when wanting VoiceOver to read the textfield.
Why is the NSAccessibilityValueChangedNotification
not requesting the TextView's NSAccessibilityValueAttribute
? How do I make VoiceOver read the text area's text?