Unverified Commit ab2d0323 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

cleanup accessibility test skips in gallery (#23977)

parent 48c00dc7
......@@ -395,6 +395,7 @@ class _BackdropDemoState extends State<BackdropDemo> with SingleTickerProviderSt
onPressed: _toggleBackdropPanelVisibility,
icon: AnimatedIcon(
icon: AnimatedIcons.close_menu,
semanticLabel: 'close',
progress: _controller.view,
),
),
......
......@@ -33,7 +33,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
label: 'circular floating action button',
value: FloatingActionButton(
onPressed: _showSnackbar,
child: Icon(Icons.add),
child: Icon(Icons.add, semanticLabel: 'Action'),
backgroundColor: Colors.orange,
),
);
......@@ -43,7 +43,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
label: 'diamond shape floating action button',
value: _DiamondFab(
onPressed: _showSnackbar,
child: Icon(Icons.add),
child: Icon(Icons.add, semanticLabel: 'Action'),
),
);
......@@ -147,7 +147,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
actions: <Widget>[
MaterialDemoDocumentationButton(BottomAppBarDemo.routeName),
IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
icon: const Icon(Icons.sentiment_very_satisfied, semanticLabel: 'Update shape'),
onPressed: () {
setState(() {
_fabShape = _fabShape == kCircularFab ? kDiamondFab : kCircularFab;
......@@ -349,7 +349,7 @@ class _DemoBottomAppBar extends StatelessWidget {
Widget build(BuildContext context) {
final List<Widget> rowContents = <Widget> [
IconButton(
icon: const Icon(Icons.menu),
icon: const Icon(Icons.menu, semanticLabel: 'Show bottom sheet'),
onPressed: () {
showModalBottomSheet<void>(
context: context,
......@@ -367,7 +367,7 @@ class _DemoBottomAppBar extends StatelessWidget {
rowContents.addAll(<Widget> [
IconButton(
icon: const Icon(Icons.search),
icon: const Icon(Icons.search, semanticLabel: 'show search action',),
onPressed: () {
Scaffold.of(context).showSnackBar(
const SnackBar(content: Text('This is a dummy search action.')),
......@@ -379,6 +379,7 @@ class _DemoBottomAppBar extends StatelessWidget {
Theme.of(context).platform == TargetPlatform.iOS
? Icons.more_horiz
: Icons.more_vert,
semanticLabel: 'Show menu actions',
),
onPressed: () {
Scaffold.of(context).showSnackBar(
......
......@@ -120,7 +120,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
demos: demos,
actions: <Widget>[
IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
icon: const Icon(Icons.sentiment_very_satisfied, semanticLabel: 'Update shape'),
onPressed: () {
setState(() {
_buttonShape = _buttonShape == null ? const StadiumBorder() : null;
......@@ -141,13 +141,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
RaisedButton(
child: const Text('RAISED BUTTON'),
child: const Text('RAISED BUTTON', semanticsLabel: 'RAISED BUTTON 1'),
onPressed: () {
// Perform some action
},
),
const RaisedButton(
child: Text('DISABLED'),
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 1'),
onPressed: null,
),
],
......@@ -157,14 +157,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
children: <Widget>[
RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('RAISED BUTTON'),
label: const Text('RAISED BUTTON', semanticsLabel: 'RAISED BUTTON 2'),
onPressed: () {
// Perform some action
},
),
RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('DISABLED'),
label: const Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 2'),
onPressed: null,
),
],
......@@ -184,13 +184,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
FlatButton(
child: const Text('FLAT BUTTON'),
child: const Text('FLAT BUTTON', semanticsLabel: 'FLAT BUTTON 1'),
onPressed: () {
// Perform some action
},
),
const FlatButton(
child: Text('DISABLED'),
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 3',),
onPressed: null,
),
],
......@@ -200,14 +200,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
children: <Widget>[
FlatButton.icon(
icon: const Icon(Icons.add_circle_outline, size: 18.0),
label: const Text('FLAT BUTTON'),
label: const Text('FLAT BUTTON', semanticsLabel: 'FLAT BUTTON 2'),
onPressed: () {
// Perform some action
},
),
FlatButton.icon(
icon: const Icon(Icons.add_circle_outline, size: 18.0),
label: const Text('DISABLED'),
label: const Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 4'),
onPressed: null,
),
],
......@@ -227,13 +227,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
OutlineButton(
child: const Text('OUTLINE BUTTON'),
child: const Text('OUTLINE BUTTON', semanticsLabel: 'OUTLINE BUTTON 1'),
onPressed: () {
// Perform some action
},
),
const OutlineButton(
child: Text('DISABLED'),
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 5'),
onPressed: null,
),
],
......@@ -243,14 +243,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
children: <Widget>[
OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('OUTLINE BUTTON'),
label: const Text('OUTLINE BUTTON', semanticsLabel: 'OUTLINE BUTTON 2'),
onPressed: () {
// Perform some action
},
),
OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('DISABLED'),
label: const Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 6'),
onPressed: null,
),
],
......@@ -360,7 +360,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
const IconButton(
icon: Icon(
Icons.thumb_up,
semanticLabel: 'Thumbs up',
semanticLabel: 'Thumbs not up',
),
onPressed: null,
)
......@@ -379,6 +379,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
onPressed: () {
// Perform some action
},
tooltip: 'floating action button',
),
);
}
......
......@@ -133,12 +133,12 @@ class TravelDestinationItem extends StatelessWidget {
alignment: MainAxisAlignment.start,
children: <Widget>[
FlatButton(
child: const Text('SHARE'),
child: Text('SHARE', semanticsLabel: 'Share ${destination.title}'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
),
FlatButton(
child: const Text('EXPLORE'),
child: Text('EXPLORE', semanticsLabel: 'Explore ${destination.title}'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
),
......@@ -172,7 +172,10 @@ class _CardsDemoState extends State<CardsDemo> {
actions: <Widget>[
MaterialDemoDocumentationButton(CardsDemo.routeName),
IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
icon: const Icon(
Icons.sentiment_very_satisfied,
semanticLabel: 'update shape',
),
onPressed: () {
setState(() {
_shape = _shape != null ? null : const RoundedRectangleBorder(
......
......@@ -141,7 +141,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
actions: <Widget>[
MaterialDemoDocumentationButton(TabsFabDemo.routeName),
IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
icon: const Icon(Icons.sentiment_very_satisfied, semanticLabel: 'Toggle extended buttons'),
onPressed: () {
setState(() {
_extendedButtons = !_extendedButtons;
......
......@@ -72,7 +72,10 @@ class _PasswordFieldState extends State<PasswordField> {
_obscureText = !_obscureText;
});
},
child: Icon(_obscureText ? Icons.visibility : Icons.visibility_off),
child: Icon(
_obscureText ? Icons.visibility : Icons.visibility_off,
semanticLabel: _obscureText ? 'show password' : 'hide password',
),
),
),
);
......
......@@ -78,7 +78,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.library_books),
icon: const Icon(Icons.library_books, semanticLabel: 'Show documentation'),
onPressed: () => _showApiDocumentation(context),
);
},
......
......@@ -243,14 +243,14 @@ void main() {
await tester.pumpWidget(MaterialApp(home: BackdropDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
......@@ -264,14 +264,14 @@ void main() {
await tester.pumpWidget(MaterialApp(home: ButtonsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('cards_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: CardsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('chip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
......@@ -446,14 +446,14 @@ void main() {
await tester.pumpWidget(MaterialApp(home: TabsFabDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('text_form_field_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose();
}, skip: true);
});
testWidgets('tooltip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
......@@ -503,7 +503,7 @@ void main() {
await tester.pumpWidget(MaterialApp(theme: theme, home: BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21651
});
testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async {
final AutomatedTestWidgetsFlutterBinding binding = tester.binding;
......@@ -521,7 +521,7 @@ void main() {
await tester.pumpWidget(MaterialApp(theme: theme, home: ButtonsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
});
testWidgets('cards_demo $themeName', (WidgetTester tester) async {
final AutomatedTestWidgetsFlutterBinding binding = tester.binding;
......@@ -530,7 +530,7 @@ void main() {
await tester.pumpWidget(MaterialApp(theme: theme, home: CardsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21651
});
testWidgets('chip_demo $themeName', (WidgetTester tester) async {
final AutomatedTestWidgetsFlutterBinding binding = tester.binding;
......
......@@ -142,7 +142,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline {
result += traverse(child);
return true;
});
if (node.isMergedIntoParent)
if (node.isMergedIntoParent || node.isInvisible || node.hasFlag(ui.SemanticsFlag.isHidden))
return result;
final SemanticsData data = node.getSemanticsData();
// Skip node if it has no actions, or is marked as hidden.
......@@ -203,9 +203,11 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
});
Future<Evaluation> evaluateNode(SemanticsNode node) async {
Evaluation result = const Evaluation.pass();
if (node.isInvisible || node.isMergedIntoParent || node.hasFlag(ui.SemanticsFlag.isHidden))
return result;
final SemanticsData data = node.getSemanticsData();
final List<SemanticsNode> children = <SemanticsNode>[];
Evaluation result = const Evaluation.pass();
node.visitChildren((SemanticsNode child) {
children.add(child);
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment