mirror of
https://github.com/flutter/flutter
synced 2024-09-12 21:01:59 +00:00
Revert "[a11y] Add semantics: button to bottom navigation bar items and dropdown menu items" (#150445)
Reverts flutter/flutter#149375 Because it failed a g3 integration testing. b/347867286
This commit is contained in:
parent
5a5f6e7666
commit
835ff2045c
|
@ -605,7 +605,6 @@ class _BottomNavigationTile extends StatelessWidget {
|
|||
|
||||
result = Semantics(
|
||||
selected: selected,
|
||||
button: true,
|
||||
container: true,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
|
|
|
@ -785,12 +785,9 @@ class _DropdownMenuItemContainer extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: _kMenuItemHeight),
|
||||
child: Align(alignment: alignment, child: child),
|
||||
),
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: _kMenuItemHeight),
|
||||
child: Align(alignment: alignment, child: child),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1586,9 +1583,9 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||
child: result,
|
||||
);
|
||||
}
|
||||
final bool childHasButtonSemantic = hintIndex != null || (_selectedIndex != null && widget.selectedItemBuilder == null);
|
||||
|
||||
return Semantics(
|
||||
button: !childHasButtonSemantic,
|
||||
button: true,
|
||||
child: Actions(
|
||||
actions: _actionMap,
|
||||
child: InkWell(
|
||||
|
|
|
@ -2108,7 +2108,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'AC\nTab 1 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
isSelected: true,
|
||||
hasTapAction: true,
|
||||
|
@ -2120,7 +2119,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Alarm\nTab 2 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2131,7 +2129,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Hot Tub\nTab 3 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2168,7 +2165,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'AC\nTab 1 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
isSelected: true,
|
||||
hasTapAction: true,
|
||||
|
@ -2180,7 +2176,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Alarm\nTab 2 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2191,7 +2186,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Hot Tub\nTab 3 of 3',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2524,7 +2518,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Red\nTab 1 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
isSelected: true,
|
||||
hasTapAction: true,
|
||||
|
@ -2536,7 +2529,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Green\nTab 2 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2571,7 +2563,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Red\nTab 1 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
isSelected: true,
|
||||
hasTapAction: true,
|
||||
|
@ -2583,7 +2574,6 @@ void main() {
|
|||
matchesSemantics(
|
||||
label: 'Green\nTab 2 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
isButton: true,
|
||||
isFocusable: true,
|
||||
hasTapAction: true,
|
||||
hasFocusAction: true,
|
||||
|
@ -2764,7 +2754,6 @@ void main() {
|
|||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
|
@ -2773,10 +2762,7 @@ void main() {
|
|||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'B\nTab 2 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
|
|
|
@ -1296,7 +1296,7 @@ void main() {
|
|||
));
|
||||
|
||||
// By default the hint contributes the label.
|
||||
expect(tester.getSemantics(find.text('test')), matchesSemantics(
|
||||
expect(tester.getSemantics(find.byKey(key)), matchesSemantics(
|
||||
isButton: true,
|
||||
label: 'test',
|
||||
hasTapAction: true,
|
||||
|
@ -1311,8 +1311,8 @@ void main() {
|
|||
hint: const Text('test'),
|
||||
));
|
||||
|
||||
// Displays label of select item.
|
||||
expect(tester.getSemantics(find.text('three')), matchesSemantics(
|
||||
// Displays label of select item and is no longer tappable.
|
||||
expect(tester.getSemantics(find.byKey(key)), matchesSemantics(
|
||||
isButton: true,
|
||||
label: 'three',
|
||||
hasTapAction: true,
|
||||
|
@ -1358,7 +1358,6 @@ void main() {
|
|||
label: 'one',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocused,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
|
@ -1368,30 +1367,21 @@ void main() {
|
|||
TestSemantics(
|
||||
label: 'two',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
),
|
||||
TestSemantics(
|
||||
label: 'three',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
),
|
||||
TestSemantics(
|
||||
label: 'four',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue