Closed
Description
The following test case was broken by #130812
testWidgets("Requesting nextFocus on node focuses its descendant", (WidgetTester tester) async {
for (bool canRequestFocus in <bool>{true, false}) {
final FocusNode node1 = FocusNode();
final FocusNode node2 = FocusNode();
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: FocusTraversalGroup(
policy: ReadingOrderTraversalPolicy(),
child: FocusScope(
child: Focus(
focusNode: node1,
canRequestFocus: canRequestFocus,
child: Focus(
focusNode: node2,
child: Container(),
),
),
),
),
),
);
final bool didFindNode = node1.nextFocus();
await tester.pump();
expect(didFindNode, isTrue);
expect(node1.hasPrimaryFocus, isFalse);
expect(node2.hasPrimaryFocus, isTrue);
}
});
Before this change, callers could call FocusNode.nextFocus()
to focus a descendant node. #130812 caused a regression whereby this no longer works.
We should check in this test and get it passing again :-)
Marking as P1 because it's a regression, but feel free to drop down to P2 if I'm misreading this.