-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Accessibility] Add .isAccessibilityContainer property, allowing automatic aggregation of children's a11y labels. #468
Conversation
…matic aggregation of children's a11y labels. After consulting Apple documentation and working with some a11y experts, we've found that aggregating objects that have a11y labels but are not themselves interactable is significantly preferred for these users. It makes it much quicker to navigate scrolling content if VoiceOver only stops to select entire cells, and then allows drilling down into the cell to select individual components. This implementation achieves that behavior. We should consider enabling isAccessibilityContainer by default on ASCellNode. This would be an improvement for 95% of a11y use cases. Aggregation can be enabled or disabled on any node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
* an aggregation of all child nodes' accessibility labels. Nodes in this node's subtree that are also accessibility containers will | ||
* not be included in this aggregation, and will be exposed as separate accessibility elements to UIKit. | ||
*/ | ||
@property (nonatomic, assign) BOOL isAccessibilityContainer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Just acknowledging that while this is not Objective-C convention (having
is
in the property name), this follows the UIAccessibility convention so good call. -
Should we use objective-C atomics here? Not a big deal either way.
NSMutableArray<ASAccessibilityElement *> *labeledNodes = [NSMutableArray array]; | ||
NSMutableArray<ASAccessibilityCustomAction *> *actions = [NSMutableArray array]; | ||
std::queue<ASDisplayNode *> queue; | ||
queue.push(container); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somebody should build an NSFastEnumeration-conforming class that takes a BFS/DFS option, a collection, and a children
block. Thinking out loud.
Great idea on the enumerator utility! We probably should set a standard for BOOLs. I worry it might miss some transactional atomicity, although in this case it is probably fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I think we are in a kind of interesting spot with having properties atomic
and some gated via the instance lock. IMHO I agree with @appleguy we should set a standard going forward and add that to our coding conventions.
👍 Thanks for this one @appleguy. We're focussing a bunch on accessibility and have tweaks to our cell nodes but containers would make much more sense than the current route we've taken. |
…matic aggregation of children's a11y labels. (TextureGroup#468) After consulting Apple documentation and working with some a11y experts, we've found that aggregating objects that have a11y labels but are not themselves interactable is significantly preferred for these users. It makes it much quicker to navigate scrolling content if VoiceOver only stops to select entire cells, and then allows drilling down into the cell to select individual components. This implementation achieves that behavior. We should consider enabling isAccessibilityContainer by default on ASCellNode. This would be an improvement for 95% of a11y use cases. Aggregation can be enabled or disabled on any node.
After consulting Apple documentation and working with some a11y experts,
we've found that aggregating objects that have a11y labels but are not
themselves interactable is significantly preferred for these users.
It makes it much quicker to navigate scrolling content if VoiceOver only
stops to select entire cells, and then allows drilling down into the cell
to select individual components. This implementation achieves that behavior.
We should consider enabling isAccessibilityContainer by default on ASCellNode.
This would be an improvement for 95% of a11y use cases. Aggregation can be
enabled or disabled on any node.