Accessibility and NSCollectionView
Accessibility and NSCollectionView
- Subject: Accessibility and NSCollectionView
- From: Bobby Thomale <email@hidden>
- Date: Fri, 31 May 2013 15:17:42 -0500
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