On Sep 2, 2016, at 3:32 AM, Bill Cheeseman < email@hidden> wrote:
On Sep 1, 2016, at 4:44 PM, Pete Brunet < email@hidden> wrote:
What is the proper way to handle hidden controls? On Win the way this is done is to remove the showing and visible states, but leave the control in the tree.
For Mac I don't see states to convey the showing/visible states? Is there such a means? Or is the proper approach to remove the control from the a11y tree?
Or is there a third approach that should be used?
That's an interesting question. I would have thought you should leave them in the tree but set the appropriate accessibility attribute. However, I don't see an accessibility 'hidden' attribute for UI elements generally. If there were one, then for standard Cocoa UI elements that can be hidden, the appropriate accessibility attribute should be set and unset for you automatically in accordance with standard Cocoa principles. See generally Apple's Accessibility Programming Guide for OS X.
The approach used in the system frameworks (Cocoa and, for those who still care, Carbon) is to remove hidden controls entirely from the accessibility hierarchy. I’d recommend that you do the same if you’re implementing your own view hierarchy.
In general, the guideline we’ve recommended is: if a sighted user can see or interact with some part of the UI, then that UI element should be provided in the accessibility hierarchy as well. If a sighted user can’t interact with a UI element, then it should not be present in the AX hierarchy. Since hidden views aren’t interactable for sighted users, they shouldn’t be provided in the AX hierarchy.
There are some exceptions, as Bill notes, below, like the ability to get all of the rows of a table element (even if some aren’t visible) but also query for just the visible rows. In this case we’re considering the “scrolled-out-of-view” rows to still be interactable, just not currently presented in the scrolling viewport. The AlternateUI attribute is also available for UI elements that only become visible via mouse-over, modifier-key-press, or some other modal gesture.
-eric
|