Re: NSTableView custom accessibility attribute
Re: NSTableView custom accessibility attribute
- Subject: Re: NSTableView custom accessibility attribute
- From: Mike Engber <email@hidden>
- Date: Tue, 30 Apr 2013 09:01:16 -0700
Inventing new attributes (or roles or actions) is not a viable approach to accessorizing custom controls. You need to represent your UI, as best you can, using the existing set of constants.
Assistive apps, like VoiceOver, won't be expecting them and will probably ignore them.
I.e. even if you get AXExtraRows to show up in Accessibility Inspector, it won't accomplish much from an accessibility perspective.
If you're using this to drive automated testing or something along those lines, that's a different story.
In your case, trying get your extra rows into the table view will probably end up being very difficult. I think it will end up requiring you to override a substantial part of the table view's accessibility implementation.
How about making them siblings of the table view? Have an AXGroup whose children are the table view plus some representation of the extra rows. You could represent the extra rows as an AXList. Make each row an AXGroup of static text, or maybe just a single static text. This is definitely not ideal, but should be more easily done and should provide some amount of accessibility.
Even doing just the above could turn out to be tricky depending on how exactly you implement your custom rows. Dealing with hit testing comes to mind as an obvious issue.
Perhaps someone from the VoiceOver team could chime in with some refinements or other representation ideas.
-ME
On Apr 29, 2013, at 4:16 PM, Dado Colussi <email@hidden> wrote:
> I have a custom NSTableView subclass that draws a few extra rows under the data rows. For example, one of these extra rows shows the sum of the numeric values in the data rows. I would like to make the extra rows available through the accessibility API.
>
> In my custom table, I introduced a new accessibility attribute AXExtraRows, but Accessibility Inspector shows "<nil>" for AXExtraRows.
>
> So I ran some experiments, and here's what I see in Accessibility Inspector:
> - If I return an empty NSArray, I see an empty collection.
> - If I return an NSArray of NSNumber objects, I see a collection of numbers.
> - If I return any subset of objects for the attribute NSAccessibilityRowsAttribute, I see the returned subset of rows.
> - But if I return an array of objects of my own class, I see "<nil>".
>
> Why Accessibility Inspector is showing nil instead of the collection of the objects I return in the code? The extra row objects present themselves as AXRow:AXTableRow.
>
> Here's the custom table code:
>
> - (NSArray*)accessibilityAttributeNames
> {
> return [[super accessibilityAttributeNames] arrayByAddingObject:@"AXExtraRows"];
> }
>
> - (id)accessibilityAttributeValue:(NSString*)attribute
> {
> if ([attribute isEqualToString:@"AXExtraRows"])
> {
> return extraRows;
> }
>
> return [super accessibilityAttributeValue:attribute];
> }
>
> Thanks for any help.
>
> /Dado
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden