From 59e892d3915db14063cc1537846cdb7264fe350a Mon Sep 17 00:00:00 2001
From: Hassan Toor <110993981+htoor3@users.noreply.github.com>
Date: Mon, 22 Jan 2024 11:03:14 -0600
Subject: [PATCH] [web] - Fix broken `TextField` in semantics mode when it's a
sibling of `Navigator` (#138446)
When a `TextField` is rendered before a `Navigator`, it breaks in semantics mode. This is because the framework generates the incorrect semantics tree (excludes the TextField) and when that tree gets sent to the engine, we don't get the signal to create the corresponding `` element.
This happens for a few reasons:
* `ModalBarrier` uses `BlockSemantics` to drop the semantics of routes beneath the current route in `Navigator`
* `ModalBarrier` mistakenly recognizes the widget outside of the `Navigator` to be its sibling
* So we end up dropping the semantics node of the `TextField` rendered before it.
The fix is to let `Navigator` generate a semantics node so that `ModalBarrier` doesn't mistakenly think widgets outside of `Navigator` are its siblings.
`Navigator` doesn't currently do this, which causes all the nodes generated from its widget subtree to be directly attached to the parent semantics node above `Navigator` - since this is also the parent of `TextField`, it considers them siblings.
Fixes https://github.com/flutter/flutter/issues/129324
---
.../flutter/lib/src/widgets/navigator.dart | 15 +-
.../test/cupertino/action_sheet_test.dart | 90 +++---
.../test/cupertino/date_picker_test.dart | 2 +-
.../flutter/test/cupertino/dialog_test.dart | 42 +--
.../test/cupertino/text_field_test.dart | 19 +-
.../flutter/test/material/app_bar_test.dart | 192 +++++++-----
.../material/bottom_navigation_bar_test.dart | 30 +-
.../test/material/bottom_sheet_test.dart | 140 +++++----
packages/flutter/test/material/chip_test.dart | 178 ++++++-----
.../flutter/test/material/dialog_test.dart | 80 ++---
.../flutter/test/material/dropdown_test.dart | 87 +++---
.../material/flexible_space_bar_test.dart | 265 ++++++++--------
.../material/floating_action_button_test.dart | 26 +-
.../test/material/icon_button_test.dart | 26 +-
.../test/material/menu_anchor_test.dart | 80 +++--
.../test/material/navigation_rail_test.dart | 62 ++--
.../test/material/popup_menu_test.dart | 294 +++++++++---------
.../flutter/test/material/search_test.dart | 232 +++++++-------
.../flutter/test/material/slider_test.dart | 285 ++++++++++-------
packages/flutter/test/material/tabs_test.dart | 2 +-
.../test/material/text_field_test.dart | 23 +-
.../flutter/test/material/tooltip_test.dart | 22 +-
.../test/material/tooltip_theme_test.dart | 44 ++-
.../user_accounts_drawer_header_test.dart | 70 +++--
.../test/semantics/traversal_order_test.dart | 117 +++----
.../flutter/test/widgets/draggable_test.dart | 102 +++---
.../test/widgets/editable_text_test.dart | 144 +++++----
.../flutter/test/widgets/navigator_test.dart | 32 ++
.../flutter/test/widgets/routes_test.dart | 29 +-
.../test/widgets/selectable_region_test.dart | 38 ++-
.../test/widgets/selectable_text_test.dart | 34 +-
...ssion_for_current_semantics_tree_test.dart | 43 +--
.../test/widgets/simple_semantics_test.dart | 16 +-
.../flutter_test/test/accessibility_test.dart | 6 +-
34 files changed, 1619 insertions(+), 1248 deletions(-)
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index e6a58beb15..c5b09ab6bd 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -5569,10 +5569,17 @@ class NavigatorState extends State with TickerProviderStateMixin, Res
includeSemantics: false,
child: UnmanagedRestorationScope(
bucket: bucket,
- child: Overlay(
- key: _overlayKey,
- clipBehavior: widget.clipBehavior,
- initialEntries: overlay == null ? _allRouteOverlayEntries.toList(growable: false) : const [],
+ // Generating a semantics node here fixes an issue where widgets rendered
+ // before Navigator mistakenly get their semantics node dropped.
+ // See: https://github.com/flutter/flutter/pull/138446
+ child: Semantics(
+ explicitChildNodes: true,
+ container: true,
+ child: Overlay(
+ key: _overlayKey,
+ clipBehavior: widget.clipBehavior,
+ initialEntries: overlay == null ? _allRouteOverlayEntries.toList(growable: false) : const [],
+ ),
),
),
),
diff --git a/packages/flutter/test/cupertino/action_sheet_test.dart b/packages/flutter/test/cupertino/action_sheet_test.dart
index c734737da0..d6fdaf12e9 100644
--- a/packages/flutter/test/cupertino/action_sheet_test.dart
+++ b/packages/flutter/test/cupertino/action_sheet_test.dart
@@ -960,63 +960,81 @@ void main() {
TestSemantics.root(
children: [
TestSemantics(
+ id: 1,
+ textDirection: TextDirection.ltr,
children: [
TestSemantics(
+ id: 2,
children: [
TestSemantics(
- flags: [
- SemanticsFlag.scopesRoute,
- SemanticsFlag.namesRoute,
- ],
- label: 'Alert',
+ id: 6,
children: [
TestSemantics(
+ id: 7,
flags: [
- SemanticsFlag.hasImplicitScrolling,
- ],
- children: [
- TestSemantics(
- label: 'The title',
- ),
- TestSemantics(
- label: 'The message',
- ),
- ],
- ),
- TestSemantics(
- flags: [
- SemanticsFlag.hasImplicitScrolling,
+ SemanticsFlag.scopesRoute,
+ SemanticsFlag.namesRoute
],
+ label: 'Alert',
+ textDirection: TextDirection.ltr,
children: [
TestSemantics(
+ id: 8,
flags: [
- SemanticsFlag.isButton,
+ SemanticsFlag.hasImplicitScrolling
],
- actions: [
- SemanticsAction.tap,
+ children: [
+ TestSemantics(
+ id: 9,
+ label: 'The title',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ id: 10,
+ label: 'The message',
+ textDirection: TextDirection.ltr,
+ ),
],
- label: 'One',
),
TestSemantics(
+ id: 11,
flags: [
- SemanticsFlag.isButton,
+ SemanticsFlag.hasImplicitScrolling
],
- actions: [
- SemanticsAction.tap,
+ children: [
+ TestSemantics(
+ id: 12,
+ flags: [
+ SemanticsFlag.isButton
+ ],
+ actions: [
+ SemanticsAction.tap
+ ],
+ label: 'One',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ id: 13,
+ flags: [
+ SemanticsFlag.isButton
+ ],
+ actions: [
+ SemanticsAction.tap
+ ],
+ label: 'Two',
+ textDirection: TextDirection.ltr,
+ ),
],
- label: 'Two',
+ ),
+ TestSemantics(
+ id: 14,
+ flags: [SemanticsFlag.isButton],
+ actions: [SemanticsAction.tap],
+ label: 'Cancel',
+ textDirection: TextDirection.ltr,
),
],
),
- TestSemantics(
- flags: [
- SemanticsFlag.isButton,
- ],
- actions: [
- SemanticsAction.tap,
- ],
- label: 'Cancel',
- ),
],
),
],
diff --git a/packages/flutter/test/cupertino/date_picker_test.dart b/packages/flutter/test/cupertino/date_picker_test.dart
index 7656623ebe..280b4ba5c8 100644
--- a/packages/flutter/test/cupertino/date_picker_test.dart
+++ b/packages/flutter/test/cupertino/date_picker_test.dart
@@ -1824,7 +1824,7 @@ void main() {
),
);
- tester.binding.pipelineOwner.semanticsOwner!.performAction(4, SemanticsAction.decrease);
+ tester.binding.pipelineOwner.semanticsOwner!.performAction(5, SemanticsAction.decrease);
await tester.pumpAndSettle();
expect(date, DateTime(2018, 6, 7));
diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart
index 24bacd2ffa..290bf258a6 100644
--- a/packages/flutter/test/cupertino/dialog_test.dart
+++ b/packages/flutter/test/cupertino/dialog_test.dart
@@ -201,33 +201,37 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute],
- label: 'Alert',
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- flags: [
- SemanticsFlag.hasImplicitScrolling,
- ],
- children: [
- TestSemantics(label: 'The Title'),
- TestSemantics(label: 'Content'),
- ],
- ),
- TestSemantics(
- flags: [
- SemanticsFlag.hasImplicitScrolling,
- ],
+ flags: [SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute],
+ label: 'Alert',
children: [
TestSemantics(
- flags: [SemanticsFlag.isButton],
- label: 'Cancel',
+ flags: [
+ SemanticsFlag.hasImplicitScrolling,
+ ],
+ children: [
+ TestSemantics(label: 'The Title'),
+ TestSemantics(label: 'Content'),
+ ],
),
TestSemantics(
- flags: [SemanticsFlag.isButton],
- label: 'OK',
+ flags: [
+ SemanticsFlag.hasImplicitScrolling,
+ ],
+ children: [
+ TestSemantics(
+ flags: [SemanticsFlag.isButton],
+ label: 'Cancel',
+ ),
+ TestSemantics(
+ flags: [SemanticsFlag.isButton],
+ label: 'OK',
+ ),
+ ],
),
],
),
diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart
index 98d73d235f..28dde9fb15 100644
--- a/packages/flutter/test/cupertino/text_field_test.dart
+++ b/packages/flutter/test/cupertino/text_field_test.dart
@@ -525,15 +525,20 @@ void main() {
children: [
TestSemantics(
id: 3,
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
id: 4,
- flags: [SemanticsFlag.isTextField,
- SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled,],
- actions: [SemanticsAction.tap,
- SemanticsAction.didGainAccessibilityFocus,],
- textDirection: TextDirection.ltr,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ id: 5,
+ flags: [SemanticsFlag.isTextField,
+ SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled,],
+ actions: [SemanticsAction.tap,
+ SemanticsAction.didGainAccessibilityFocus,],
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -548,7 +553,7 @@ void main() {
));
expect(focusNode.hasFocus, isFalse);
- semanticsOwner.performAction(4, SemanticsAction.didGainAccessibilityFocus);
+ semanticsOwner.performAction(5, SemanticsAction.didGainAccessibilityFocus);
await tester.pumpAndSettle();
expect(focusNode.hasFocus, isTrue);
semantics.dispose();
diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart
index 441e2c966c..1231725e4d 100644
--- a/packages/flutter/test/material/app_bar_test.dart
+++ b/packages/flutter/test/material/app_bar_test.dart
@@ -2369,37 +2369,41 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'Leading',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- flags: [
- SemanticsFlag.namesRoute,
- SemanticsFlag.isHeader,
+ children: [
+ TestSemantics(
+ label: 'Leading',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ flags: [
+ SemanticsFlag.namesRoute,
+ SemanticsFlag.isHeader,
+ ],
+ label: 'Title',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 1',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 2',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 3',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Bottom',
+ textDirection: TextDirection.ltr,
+ ),
],
- label: 'Title',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Action 1',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Action 2',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Action 3',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Bottom',
- textDirection: TextDirection.ltr,
),
],
),
@@ -2456,40 +2460,44 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- textDirection: TextDirection.rtl,
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ textDirection: TextDirection.rtl,
children: [
TestSemantics(
- label: 'Leading',
- textDirection: TextDirection.rtl,
- ),
- TestSemantics(
- flags: [
- SemanticsFlag.namesRoute,
- SemanticsFlag.isHeader,
+ children: [
+ TestSemantics(
+ label: 'Leading',
+ textDirection: TextDirection.rtl,
+ ),
+ TestSemantics(
+ flags: [
+ SemanticsFlag.namesRoute,
+ SemanticsFlag.isHeader,
+ ],
+ label: 'Title',
+ textDirection: TextDirection.rtl,
+ ),
+ TestSemantics(
+ label: 'Action 1',
+ textDirection: TextDirection.rtl,
+ ),
+ TestSemantics(
+ label: 'Action 2',
+ textDirection: TextDirection.rtl,
+ ),
+ TestSemantics(
+ label: 'Action 3',
+ textDirection: TextDirection.rtl,
+ ),
+ TestSemantics(
+ label: 'Bottom',
+ textDirection: TextDirection.rtl,
+ ),
],
- label: 'Title',
- textDirection: TextDirection.rtl,
- ),
- TestSemantics(
- label: 'Action 1',
- textDirection: TextDirection.rtl,
- ),
- TestSemantics(
- label: 'Action 2',
- textDirection: TextDirection.rtl,
- ),
- TestSemantics(
- label: 'Action 3',
- textDirection: TextDirection.rtl,
- ),
- TestSemantics(
- label: 'Bottom',
- textDirection: TextDirection.rtl,
),
],
),
@@ -2537,17 +2545,21 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'Leading',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Action 1',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ label: 'Leading',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 1',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -2594,30 +2606,34 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
children: [
TestSemantics(
children: [
TestSemantics(
- label: 'Leading',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- label: 'Action 1',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ label: 'Leading',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 1',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
+ TestSemantics(),
],
),
- TestSemantics(),
+ TestSemantics(
+ flags: [SemanticsFlag.hasImplicitScrolling],
+ ),
],
),
- TestSemantics(
- flags: [SemanticsFlag.hasImplicitScrolling],
- ),
],
),
],
@@ -2663,38 +2679,42 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
children: [
TestSemantics(
children: [
TestSemantics(
- label: 'Leading',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ label: 'Leading',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ label: 'Action 1',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
TestSemantics(
- label: 'Action 1',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ flags: [SemanticsFlag.isHeader],
+ label: 'Flexible space',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
TestSemantics(
- children: [
- TestSemantics(
- flags: [SemanticsFlag.isHeader],
- label: 'Flexible space',
- textDirection: TextDirection.ltr,
- ),
- ],
+ flags: [SemanticsFlag.hasImplicitScrolling],
),
],
),
- TestSemantics(
- flags: [SemanticsFlag.hasImplicitScrolling],
- ),
],
),
],
diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart
index b9fc12edee..edad467bf7 100644
--- a/packages/flutter/test/material/bottom_navigation_bar_test.dart
+++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart
@@ -2738,24 +2738,28 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- flags: [
- SemanticsFlag.isSelected,
- SemanticsFlag.isFocusable,
+ children: [
+ TestSemantics(
+ flags: [
+ SemanticsFlag.isSelected,
+ SemanticsFlag.isFocusable,
+ ],
+ actions: [SemanticsAction.tap],
+ label: 'A\nTab 1 of 2',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ flags: [SemanticsFlag.isFocusable],
+ actions: [SemanticsAction.tap],
+ label: 'B\nTab 2 of 2',
+ textDirection: TextDirection.ltr,
+ ),
],
- actions: [SemanticsAction.tap],
- label: 'A\nTab 1 of 2',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- flags: [SemanticsFlag.isFocusable],
- actions: [SemanticsAction.tap],
- label: 'B\nTab 2 of 2',
- textDirection: TextDirection.ltr,
),
],
),
diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart
index 8d1358dcc9..101b5dfa7a 100644
--- a/packages/flutter/test/material/bottom_sheet_test.dart
+++ b/packages/flutter/test/material/bottom_sheet_test.dart
@@ -839,27 +839,31 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- label: 'Dialog',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.scopesRoute,
- SemanticsFlag.namesRoute,
- ],
children: [
TestSemantics(
- label: 'BottomSheet',
+ label: 'Dialog',
textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.scopesRoute,
+ SemanticsFlag.namesRoute,
+ ],
+ children: [
+ TestSemantics(
+ label: 'BottomSheet',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
- ],
- ),
- TestSemantics(
- children: [
TestSemantics(
- actions: [SemanticsAction.tap, SemanticsAction.dismiss],
- label: 'Scrim',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ actions: [SemanticsAction.tap, SemanticsAction.dismiss],
+ label: 'Scrim',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -1011,32 +1015,36 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- label: 'Dialog',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.scopesRoute,
- SemanticsFlag.namesRoute,
- ],
children: [
TestSemantics(
- flags: [SemanticsFlag.hasImplicitScrolling],
+ label: 'Dialog',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.scopesRoute,
+ SemanticsFlag.namesRoute,
+ ],
children: [
TestSemantics(
- label: 'BottomSheet',
- textDirection: TextDirection.ltr,
+ flags: [SemanticsFlag.hasImplicitScrolling],
+ children: [
+ TestSemantics(
+ label: 'BottomSheet',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
],
),
- ],
- ),
- TestSemantics(
- children: [
TestSemantics(
- actions: [SemanticsAction.tap, SemanticsAction.dismiss],
- label: 'Scrim',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ actions: [SemanticsAction.tap, SemanticsAction.dismiss],
+ label: 'Scrim',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -1084,21 +1092,25 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- label: 'Dialog',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.scopesRoute,
- SemanticsFlag.namesRoute,
- ],
children: [
TestSemantics(
+ label: 'Dialog',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.scopesRoute,
+ SemanticsFlag.namesRoute,
+ ],
children: [
TestSemantics(
- flags: [SemanticsFlag.hasImplicitScrolling],
children: [
TestSemantics(
- label: 'BottomSheet',
- textDirection: TextDirection.ltr,
+ flags: [SemanticsFlag.hasImplicitScrolling],
+ children: [
+ TestSemantics(
+ label: 'BottomSheet',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -1106,14 +1118,14 @@ void main() {
),
],
),
- ],
- ),
- TestSemantics(
- children: [
TestSemantics(
- actions: [SemanticsAction.tap, SemanticsAction.dismiss],
- label: 'Scrim',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ actions: [SemanticsAction.tap, SemanticsAction.dismiss],
+ label: 'Scrim',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
@@ -1155,34 +1167,38 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- label: 'Dialog',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.scopesRoute,
- SemanticsFlag.namesRoute,
- ],
children: [
TestSemantics(
- label: 'BottomSheet',
+ label: 'Dialog',
textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.scopesRoute,
+ SemanticsFlag.namesRoute,
+ ],
children: [
TestSemantics(
- actions: [SemanticsAction.tap],
- label: 'Dismiss',
+ label: 'BottomSheet',
textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ actions: [SemanticsAction.tap],
+ label: 'Dismiss',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
],
),
- ],
- ),
- TestSemantics(
- children: [
TestSemantics(
- actions: [SemanticsAction.tap, SemanticsAction.dismiss],
- label: 'Scrim',
- textDirection: TextDirection.ltr,
+ children: [
+ TestSemantics(
+ actions: [SemanticsAction.tap, SemanticsAction.dismiss],
+ label: 'Scrim',
+ textDirection: TextDirection.ltr,
+ ),
+ ],
),
],
),
diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart
index 96da8329a6..ccd8ea4102 100644
--- a/packages/flutter/test/material/chip_test.dart
+++ b/packages/flutter/test/material/chip_test.dart
@@ -2896,14 +2896,18 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ ],
+ ),
],
),
],
@@ -2945,23 +2949,27 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
- ],
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- tooltip: 'Delete',
- actions: [SemanticsAction.tap],
+ label: 'test',
textDirection: TextDirection.ltr,
flags: [
+ SemanticsFlag.hasEnabledState,
SemanticsFlag.isButton,
- SemanticsFlag.isFocusable,
+ ],
+ children: [
+ TestSemantics(
+ tooltip: 'Delete',
+ actions: [SemanticsAction.tap],
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.isButton,
+ SemanticsFlag.isFocusable,
+ ],
+ ),
],
),
],
@@ -3005,18 +3013,22 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
- SemanticsFlag.isEnabled,
- SemanticsFlag.isFocusable,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ SemanticsFlag.isEnabled,
+ SemanticsFlag.isFocusable,
+ ],
+ actions: [SemanticsAction.tap],
+ ),
],
- actions: [SemanticsAction.tap],
),
],
),
@@ -3063,18 +3075,22 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
- SemanticsFlag.isEnabled,
- SemanticsFlag.isFocusable,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ SemanticsFlag.isEnabled,
+ SemanticsFlag.isFocusable,
+ ],
+ actions: [SemanticsAction.tap],
+ ),
],
- actions: [SemanticsAction.tap],
),
],
),
@@ -3115,19 +3131,23 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
- SemanticsFlag.isEnabled,
- SemanticsFlag.isFocusable,
- SemanticsFlag.isSelected,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ SemanticsFlag.isEnabled,
+ SemanticsFlag.isFocusable,
+ SemanticsFlag.isSelected,
+ ],
+ actions: [SemanticsAction.tap],
+ ),
],
- actions: [SemanticsAction.tap],
),
],
),
@@ -3170,16 +3190,20 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ ],
+ actions: [],
+ ),
],
- actions: [],
),
],
),
@@ -3221,13 +3245,17 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [], // Must not be a button when tapping is disabled.
- actions: [],
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [], // Must not be a button when tapping is disabled.
+ actions: [],
+ ),
+ ],
),
],
),
@@ -3270,18 +3298,22 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
- SemanticsFlag.isEnabled,
- SemanticsFlag.isFocusable,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ SemanticsFlag.isEnabled,
+ SemanticsFlag.isFocusable,
+ ],
+ actions: [SemanticsAction.tap],
+ ),
],
- actions: [SemanticsAction.tap],
),
],
),
@@ -3322,14 +3354,18 @@ void main() {
TestSemantics(
children: [
TestSemantics(
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
- label: 'test',
- textDirection: TextDirection.ltr,
- flags: [
- SemanticsFlag.hasEnabledState,
- SemanticsFlag.isButton,
+ flags: [SemanticsFlag.scopesRoute],
+ children: [
+ TestSemantics(
+ label: 'test',
+ textDirection: TextDirection.ltr,
+ flags: [
+ SemanticsFlag.hasEnabledState,
+ SemanticsFlag.isButton,
+ ],
+ ),
],
),
],
diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart
index d3b47c8704..1353e36655 100644
--- a/packages/flutter/test/material/dialog_test.dart
+++ b/packages/flutter/test/material/dialog_test.dart
@@ -1716,31 +1716,36 @@ void main() {
children: [
TestSemantics(
id: 3,
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
id: 4,
+ flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
id: 5,
- label: 'title',
- textDirection: TextDirection.ltr,
- ),
- // The content semantics does not merge into the semantics
- // node 4.
- TestSemantics(
- id: 6,
- label: 'content',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- id: 7,
- flags: [
- SemanticsFlag.isButton,
- SemanticsFlag.hasEnabledState,
+ children: [
+ TestSemantics(
+ id: 6,
+ label: 'title',
+ textDirection: TextDirection.ltr,
+ ),
+ // The content semantics does not merge into the semantics
+ // node 4.
+ TestSemantics(
+ id: 7,
+ label: 'content',
+ textDirection: TextDirection.ltr,
+ ),
+ TestSemantics(
+ id: 8,
+ flags: [
+ SemanticsFlag.isButton,
+ SemanticsFlag.hasEnabledState,
+ ],
+ label: 'action',
+ textDirection: TextDirection.ltr,
+ ),
],
- label: 'action',
- textDirection: TextDirection.ltr,
),
],
),
@@ -1882,35 +1887,40 @@ void main() {
children: [
TestSemantics(
id: 3,
- flags: [SemanticsFlag.scopesRoute],
children: [
TestSemantics(
id: 4,
+ flags: [SemanticsFlag.scopesRoute],
children: [
- // Title semantics does not merge into the semantics
- // node 4.
TestSemantics(
id: 5,
- label: 'title',
- textDirection: TextDirection.ltr,
- ),
- TestSemantics(
- id: 6,
- flags: [SemanticsFlag.hasImplicitScrolling],
children: