From 4fd6188d48f3583dd9e701ccd7b46d9acda1c593 Mon Sep 17 00:00:00 2001 From: Natalie Sampsell Date: Tue, 31 Jul 2018 16:56:20 -0700 Subject: [PATCH] Fix SegmentedControl accessibility (#19994) --- packages/flutter/lib/src/cupertino/segmented_control.dart | 1 + packages/flutter/test/cupertino/segmented_control_test.dart | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/flutter/lib/src/cupertino/segmented_control.dart b/packages/flutter/lib/src/cupertino/segmented_control.dart index ca111c042a..1340a92473 100644 --- a/packages/flutter/lib/src/cupertino/segmented_control.dart +++ b/packages/flutter/lib/src/cupertino/segmented_control.dart @@ -313,6 +313,7 @@ class _SegmentedControlState extends State> child: new DefaultTextStyle( style: textStyle, child: new Semantics( + button: true, inMutuallyExclusiveGroup: true, selected: widget.groupValue == currentKey, child: child, diff --git a/packages/flutter/test/cupertino/segmented_control_test.dart b/packages/flutter/test/cupertino/segmented_control_test.dart index f168176aec..502724e059 100644 --- a/packages/flutter/test/cupertino/segmented_control_test.dart +++ b/packages/flutter/test/cupertino/segmented_control_test.dart @@ -606,6 +606,7 @@ void main() { new TestSemantics.rootChild( label: 'Child 1', flags: [ + SemanticsFlag.isButton, SemanticsFlag.isInMutuallyExclusiveGroup, SemanticsFlag.isSelected, ], @@ -616,6 +617,7 @@ void main() { new TestSemantics.rootChild( label: 'Child 2', flags: [ + SemanticsFlag.isButton, SemanticsFlag.isInMutuallyExclusiveGroup, ], actions: [ @@ -640,6 +642,7 @@ void main() { new TestSemantics.rootChild( label: 'Child 1', flags: [ + SemanticsFlag.isButton, SemanticsFlag.isInMutuallyExclusiveGroup, ], actions: [ @@ -649,6 +652,7 @@ void main() { new TestSemantics.rootChild( label: 'Child 2', flags: [ + SemanticsFlag.isButton, SemanticsFlag.isInMutuallyExclusiveGroup, SemanticsFlag.isSelected, ],