Re: Accessibility and NSCollectionView
Re: Accessibility and NSCollectionView
- Subject: Re: Accessibility and NSCollectionView
- From: Bobby Thomale <email@hidden>
- Date: Tue, 04 Jun 2013 16:25:51 -0500
Good news, I think I've just about got this working. The hard part
anyway: the child proxy objects. Still a few other grid methods to
fill in but it looks like its working now.
I'll definitely compare it to any official implementation once I get
my hands on one (I'll have NewCat partition all ready!) and bug you
guys with any problems in the labs next week. But I think I finally
powered through this today.
On Mon, Jun 3, 2013 at 9:33 AM, Bobby Thomale <email@hidden> wrote:
> Also, the documentation link was a big help. I can't believe I never
> knew this existed!
>
> I've always been using this one instead, which is not nearly this complete.
>
> https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html
>
> It lists all of the constant names but does not really describe them.
> I've always had to guess.
>
> On Mon, Jun 3, 2013 at 9:18 AM, Bobby Thomale <email@hidden> wrote:
>>> Using Accessibility Inspector, I can see that NSCollectionViews have
>>> NSAccessibilityGridRole by default.
>>
>> Actually, as of 10.8.3, the default as shown by Accessibility
>> Inspector is AXGroup, with a role description of "group." I tried the
>> Reviews sample you pointed me at and got the same result that I had
>> gotten with my NSCollectionView.
>>
>> Are you sure you aren't looking at "a future version of OS X" as Eric mentions?
>>
>> Looking forward to that. I am going to hack on this a little bit this
>> week, but it sounds like after next week I'll probably have a better
>> idea of how to make this work, so I'm not going to stress too much
>> about it. :)
>>
>> Thanks guys!
>>
>>
>>
>>
>> On Sat, Jun 1, 2013 at 1:54 AM, Josh Scotland <email@hidden> wrote:
>>> Hey Bobby,
>>>
>>> I think the NSAccessibilityGridRole is what I should be using for a
>>> role, but I'm not entirely sure.
>>>
>>> Using Accessibility Inspector, I can see that NSCollectionViews have
>>> NSAccessibilityGridRole by default.
>>>
>>> Is there any sample code for this?
>>>
>>> There’s a sample project called Reviews that shows an accessorized
>>> NSCollectionView, but it's fairly dated:
>>> https://developer.apple.com/library/mac/samplecode/Reviews/
>>>
>>> Only, there's no documentation of exactly which attributes
>>> are expected with which roles.
>>>
>>> Here’s a link to documentation that specifies all the required attributes
>>> for each role:
>>> https://developer.apple.com/library/mac/#documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Introduction.html
>>>
>>> I'm going to start hacking on this now but I may have some
>>> questions by WWDC to bug some Apple engineers in the lab with! :)
>>>
>>> See you at WWDC :D
>>>
>>> Josh
>>>
>>> On May 31, 2013, at 11:16 PM, Eric Schlegel <email@hidden> wrote:
>>>
>>> FWIW, a future version of OS X is expected to have much better accessibility
>>> support for NSCollectionView. You might consider waiting a week or so, at
>>> least for purposes of comparing your implementation with ours.
>>>
>>> -eric
>>>
>>>
>>> On May 31, 2013, at 1:17 PM, Bobby Thomale <email@hidden> wrote:
>>>
>>> Hi all,
>>>
>>>
>>> I'm using NSCollectionView to implement a grid of objects, similar to
>>>
>>> the Finder in icon view, except it also reflows as you resize the
>>>
>>> window.
>>>
>>>
>>> I'm noticing that (apparently) its up to us to implement accessibility
>>>
>>> for this ourselves. I would have expected some built-in accessibility
>>>
>>> (similar to NSTableView) but apparently there's nothing beyond what's
>>>
>>> built into NSView (which is not very useful for this). Which is
>>>
>>> disappointing. A collection view is very similar conceptually to a
>>>
>>> table view, its just a different shape (and a little more flexible).
>>>
>>>
>>> So it looks like I have to subclass NSCollectionView and implement the
>>>
>>> NSAccessibility protocol myself.
>>>
>>>
>>> I think the NSAccessibilityGridRole is what I should be using for a
>>>
>>> role, but I'm not entirely sure.
>>>
>>>
>>> Also, I can't just rely on it to expose all of its children in
>>>
>>> standard NSView fashion because of how it virtualizes its children. A
>>>
>>> collection view with 2000 items in it will appear to only have a few
>>>
>>> children (essentially, the visible views) - for example, it might just
>>>
>>> have 12 children at first, but more will appear as you scroll. And
>>>
>>> presumably some of the views will also disappear as you continue to
>>>
>>> scroll.
>>>
>>>
>>> So, that means instead of relying on the built-in behavior I'll need
>>>
>>> to implement my own proxy objects to use as children instead of the
>>>
>>> views.
>>>
>>>
>>> Is there any sample code for this? It seems like adding accessibility
>>>
>>> to an NSCollectionView is something that would make a good sample code
>>>
>>> project. It is way more involved than it ought to be. I looked but I
>>>
>>> couldn't find any. Maybe I just missed it?
>>>
>>>
>>> I think I know the basics already from having done this a few other
>>>
>>> times. (I've made my own custom text control accessible, that was a
>>>
>>> lot of work!) I've seen the existing sample project for doing proxy
>>>
>>> objects. I'm going to start hacking on this now but I may have some
>>>
>>> questions by WWDC to bug some Apple engineers in the lab with! :)
>>>
>>>
>>> Figured I'd ask here too, just in case I'm missing something obvious
>>>
>>> (like, real sample code).
>>>
>>>
>>> It seems like the docs could be better for some of this. For example,
>>>
>>> I wish there were better documentation on what attributes and
>>>
>>> parameters are expected by objects with the different roles. The
>>>
>>> accessibility API is almost like an object model, with "roles" in
>>>
>>> place of classes, and attributes and parameterized attributes in place
>>>
>>> of members. Only, there's no documentation of exactly which attributes
>>>
>>> are expected with which roles. You can kind of guess by reading the
>>>
>>> text descriptions of each, but there is still a lot of guesswork.
>>>
>>>
>>> --
>>>
>>> Bobby Thomale
>>>
>>> Vital Source Technologies
>>>
>>> http://www.vitalsource.com
>>>
>>> _______________________________________________
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>>
>> --
>> Bobby Thomale
>> Vital Source Technologies
>> http://www.vitalsource.com
>
>
>
> --
> Bobby Thomale
> Vital Source Technologies
> http://www.vitalsource.com
--
Bobby Thomale
Vital Source Technologies
http://www.vitalsource.com
_______________________________________________
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