Fix SegmentedControl accessibility (#19994)

This commit is contained in:
Natalie Sampsell
2018-07-31 16:56:20 -07:00
committed by GitHub
parent ab9f17cbbe
commit 4fd6188d48
2 changed files with 5 additions and 0 deletions

View File

@@ -313,6 +313,7 @@ class _SegmentedControlState<T> extends State<SegmentedControl<T>>
child: new DefaultTextStyle(
style: textStyle,
child: new Semantics(
button: true,
inMutuallyExclusiveGroup: true,
selected: widget.groupValue == currentKey,
child: child,

View File

@@ -606,6 +606,7 @@ void main() {
new TestSemantics.rootChild(
label: 'Child 1',
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
SemanticsFlag.isSelected,
],
@@ -616,6 +617,7 @@ void main() {
new TestSemantics.rootChild(
label: 'Child 2',
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
],
actions: <SemanticsAction>[
@@ -640,6 +642,7 @@ void main() {
new TestSemantics.rootChild(
label: 'Child 1',
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
],
actions: <SemanticsAction>[
@@ -649,6 +652,7 @@ void main() {
new TestSemantics.rootChild(
label: 'Child 2',
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
SemanticsFlag.isSelected,
],