Reverts "Request focus if SemanticsAction.focus is sent to a focusable widget (#142942)" (#149741)

Reverts: flutter/flutter#142942
Initiated by: zanderso
Reason for reverting: Seems to have affected iOS platform view focus: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20native_platform_view_ui_tests_ios/10626/overview
Original PR Author: gspencergoog

Reviewed By: {yjbanov, goderbauer, chunhtai}

This change reverts the following previous change:
## Description

This causes the `Focus` widget to request focus on its focus node if the accessibility system (screen reader) focuses a widget via the `SemanticsAction.focus` action.

## Related Issues
 - https://github.com/flutter/flutter/issues/83809

## Tests
 - Added a test to make sure that focus is requested when `SemanticsAction.focus` is sent by the engine.
This commit is contained in:
auto-submit[bot]
2024-06-05 14:54:18 +00:00
committed by GitHub
parent 63daac2a51
commit ec9965bd89
58 changed files with 70 additions and 281 deletions

View File

@@ -674,7 +674,6 @@ Matcher matchesSemantics({
bool isExpanded = false,
// Actions //
bool hasTapAction = false,
bool hasFocusAction = false,
bool hasLongPressAction = false,
bool hasScrollLeftAction = false,
bool hasScrollRightAction = false,
@@ -754,7 +753,6 @@ Matcher matchesSemantics({
isExpanded: isExpanded,
// Actions
hasTapAction: hasTapAction,
hasFocusAction: hasFocusAction,
hasLongPressAction: hasLongPressAction,
hasScrollLeftAction: hasScrollLeftAction,
hasScrollRightAction: hasScrollRightAction,
@@ -862,7 +860,6 @@ Matcher containsSemantics({
bool? isExpanded,
// Actions
bool? hasTapAction,
bool? hasFocusAction,
bool? hasLongPressAction,
bool? hasScrollLeftAction,
bool? hasScrollRightAction,
@@ -942,7 +939,6 @@ Matcher containsSemantics({
isExpanded: isExpanded,
// Actions
hasTapAction: hasTapAction,
hasFocusAction: hasFocusAction,
hasLongPressAction: hasLongPressAction,
hasScrollLeftAction: hasScrollLeftAction,
hasScrollRightAction: hasScrollRightAction,
@@ -2263,7 +2259,6 @@ class _MatchesSemanticsData extends Matcher {
required bool? isExpanded,
// Actions
required bool? hasTapAction,
required bool? hasFocusAction,
required bool? hasLongPressAction,
required bool? hasScrollLeftAction,
required bool? hasScrollRightAction,
@@ -2322,7 +2317,6 @@ class _MatchesSemanticsData extends Matcher {
},
actions = <SemanticsAction, bool>{
if (hasTapAction != null) SemanticsAction.tap: hasTapAction,
if (hasFocusAction != null) SemanticsAction.focus: hasFocusAction,
if (hasLongPressAction != null) SemanticsAction.longPress: hasLongPressAction,
if (hasScrollLeftAction != null) SemanticsAction.scrollLeft: hasScrollLeftAction,
if (hasScrollRightAction != null) SemanticsAction.scrollRight: hasScrollRightAction,
@@ -2385,8 +2379,8 @@ class _MatchesSemanticsData extends Matcher {
final Map<SemanticsFlag, bool> flags;
@override
Description describe(Description description, [String? index]) {
description.add('${index == null ? '' : 'Child $index '}has semantics');
Description describe(Description description) {
description.add('has semantics');
if (label != null) {
description.add(' with label: $label');
}
@@ -2485,15 +2479,9 @@ class _MatchesSemanticsData extends Matcher {
description.add(' with custom hints: $hintOverrides');
}
if (children != null) {
description.add(' with children:\n ');
final List<_MatchesSemanticsData> childMatches = children!.cast<_MatchesSemanticsData>();
int childIndex = 1;
for (final _MatchesSemanticsData child in childMatches) {
child.describe(description, index != null ? '$index:$childIndex': '$childIndex');
if (child != childMatches.last) {
description.add('\n ');
}
childIndex += 1;
description.add(' with children:\n');
for (final _MatchesSemanticsData child in children!.cast<_MatchesSemanticsData>()) {
child.describe(description);
}
}
return description;

View File

@@ -746,7 +746,6 @@ void main() {
hasDidGainAccessibilityFocusAction: true,
hasDidLoseAccessibilityFocusAction: true,
hasDismissAction: true,
hasFocusAction: true,
customActions: <CustomSemanticsAction>[action],
));
});
@@ -1034,7 +1033,6 @@ void main() {
hasDidGainAccessibilityFocusAction: true,
hasDidLoseAccessibilityFocusAction: true,
hasDismissAction: true,
hasFocusAction: true,
customActions: <CustomSemanticsAction>[action],
),
);
@@ -1127,7 +1125,6 @@ void main() {
hasDidGainAccessibilityFocusAction: false,
hasDidLoseAccessibilityFocusAction: false,
hasDismissAction: false,
hasFocusAction: false,
),
);
});