Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,4 @@ - (NSInteger)accessibilityElementCount {
return [[_semanticsObject children] count];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chunhtai Should we remove this method too?

}

- (id)accessibilityElementAtIndex:(NSInteger)index {
SemanticsObject* child = [_semanticsObject children][index];

// Swap the original `SemanticsObject` to a `PlatformViewSemanticsContainer`
if (child.node.IsPlatformViewNode()) {
child.platformViewSemanticsContainer.index = index;
return child.platformViewSemanticsContainer;
}

if ([child hasChildren])
return [child accessibilityContainer];
return [child nativeAccessibility];
}

- (NSInteger)indexOfAccessibilityElement:(id)element {
if ([element isKindOfClass:[FlutterPlatformViewSemanticsContainer class]]) {
return ((FlutterPlatformViewSemanticsContainer*)element).index;
}

NSArray<SemanticsObject*>* children = [_semanticsObject children];
for (size_t i = 0; i < [children count]; i++) {
SemanticsObject* child = children[i];
if ((![child hasChildren] && child == element) ||
([child hasChildren] && [child accessibilityContainer] == element))
return i;
}
return NSNotFound;
}

@end