mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-14 16:08:51 +00:00
Recreate the accessibleElements if accessed
This commit is contained in:
parent
39950e74b2
commit
3b91c22fdf
@ -411,10 +411,6 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
|||||||
|
|
||||||
- (NSArray *)accessibleElements
|
- (NSArray *)accessibleElements
|
||||||
{
|
{
|
||||||
if ( _accessibleElements != nil ) {
|
|
||||||
return _accessibleElements;
|
|
||||||
}
|
|
||||||
|
|
||||||
_accessibleElements = [[NSMutableArray alloc] init];
|
_accessibleElements = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
ASDisplayNode *selfNode = self.asyncdisplaykit_node;
|
ASDisplayNode *selfNode = self.asyncdisplaykit_node;
|
||||||
@ -451,7 +447,7 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
|||||||
for (ASDisplayNode *subnode in selfNode.subnodes) {
|
for (ASDisplayNode *subnode in selfNode.subnodes) {
|
||||||
// Check if this subnode is a UIAccessibilityContainer
|
// Check if this subnode is a UIAccessibilityContainer
|
||||||
if (!subnode.isAccessibilityElement && [subnode accessibilityElementCount] > 0) {
|
if (!subnode.isAccessibilityElement && [subnode accessibilityElementCount] > 0) {
|
||||||
// We are good and the view is an UIAccessibilityContainer so add that
|
// We are good and the view is an UIAccessibilityContainer so add it
|
||||||
[_accessibleElements addObject:subnode.view];
|
[_accessibleElements addObject:subnode.view];
|
||||||
} else if (subnode.isAccessibilityElement) {
|
} else if (subnode.isAccessibilityElement) {
|
||||||
// Create a accessiblity element from the subnode
|
// Create a accessiblity element from the subnode
|
||||||
@ -471,7 +467,11 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
|||||||
|
|
||||||
- (id)accessibilityElementAtIndex:(NSInteger)index
|
- (id)accessibilityElementAtIndex:(NSInteger)index
|
||||||
{
|
{
|
||||||
UIAccessibilityElement *accessibilityElement = [[self accessibleElements] objectAtIndex:index];
|
if (_accessibleElements == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIAccessibilityElement *accessibilityElement = [_accessibleElements objectAtIndex:index];
|
||||||
ASDisplayNode *accessibilityElementNode = accessibilityElement.asyncdisplaykit_node;
|
ASDisplayNode *accessibilityElementNode = accessibilityElement.asyncdisplaykit_node;
|
||||||
if (accessibilityElementNode == nil) {
|
if (accessibilityElementNode == nil) {
|
||||||
return nil;
|
return nil;
|
||||||
@ -497,7 +497,11 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
|||||||
|
|
||||||
- (NSInteger)indexOfAccessibilityElement:(id)element
|
- (NSInteger)indexOfAccessibilityElement:(id)element
|
||||||
{
|
{
|
||||||
return [self.accessibleElements indexOfObject:element];
|
if (_accessibleElements == nil) {
|
||||||
|
return NSNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [_accessibleElements indexOfObject:element];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user