Skip to content
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

Make ASEditableTextNode accessible to VoiceOver #1162

Merged
merged 13 commits into from
Nov 10, 2018
34 changes: 34 additions & 0 deletions Source/ASEditableTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -842,4 +842,38 @@ - (void)_delegateDidFinishEditing
[_delegate editableTextNodeDidFinishEditing:self];
}

ay8s marked this conversation as resolved.
Show resolved Hide resolved
#pragma mark - UIAccessibilityContainer

- (NSInteger)accessibilityElementCount
{
if (!self.isNodeLoaded) {
ASDisplayNodeFailAssert(@"Cannot access accessibilityElementCount since ASEditableTextNode is not loaded");
return 0;
}
return 1;
}

- (NSArray *)accessibilityElements
ay8s marked this conversation as resolved.
Show resolved Hide resolved
{
if (!self.isNodeLoaded) {
ASDisplayNodeFailAssert(@"Cannot access accessibilityElements since ASEditableTextNode is not loaded");
return @[];
}
return @[self.textView];
}

- (id)accessibilityElementAtIndex:(NSInteger)index
{
if (!self.isNodeLoaded) {
ASDisplayNodeFailAssert(@"Cannot access accessibilityElementAtIndex: since ASEditableTextNode is not loaded");
return nil;
}
return self.textView;
}

- (NSInteger)indexOfAccessibilityElement:(id)element
{
return 0;
}

@end