Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6ca023f

Browse files
Make menu and dialogs reachable
1 parent dcdea31 commit 6ca023f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

shell/platform/darwin/ios/framework/Source/SemanticsObject+UIFocusSystem.mm

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,20 @@ - (CGRect)frame {
8080
- (NSArray<id<UIFocusItem>>*)focusItemsInRect:(CGRect)rect {
8181
// It seems the iOS focus system relies heavily on focusItemsInRect
8282
// (instead of preferredFocusEnvironments) for directional navigation.
83-
// Whether the item order in the returned array matters is unknown.
8483
//
85-
// Additionally, this method is only supposed to return items within the given
84+
// The order of the items seems to be important, menus and dialogs become
85+
// unreachable via FKA if the returned children are organized
86+
// in hit-test order.
87+
//
88+
// This method is only supposed to return items within the given
8689
// rect but returning everything in the subtree seems to work fine.
87-
return self.childrenInHitTestOrder;
90+
NSMutableArray<SemanticsObject*>* reversedItems =
91+
[[NSMutableArray alloc] initWithCapacity:self.childrenInHitTestOrder.count];
92+
for (NSUInteger i = 0; i < self.childrenInHitTestOrder.count; ++i) {
93+
[reversedItems
94+
addObject:self.childrenInHitTestOrder[self.childrenInHitTestOrder.count - 1 - i]];
95+
}
96+
return reversedItems;
8897
}
8998

9099
- (id<UICoordinateSpace>)coordinateSpace {

0 commit comments

Comments
 (0)