Unverified Commit ef20f726 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Gallery a11y fix: give the categories and demos pages "route" scope (#17516)

parent 6c8d5f1b
...@@ -109,7 +109,12 @@ class _CategoriesPage extends StatelessWidget { ...@@ -109,7 +109,12 @@ class _CategoriesPage extends StatelessWidget {
final List<GalleryDemoCategory> categoriesList = categories.toList(); final List<GalleryDemoCategory> categoriesList = categories.toList();
final int columnCount = (MediaQuery.of(context).orientation == Orientation.portrait) ? 2 : 3; final int columnCount = (MediaQuery.of(context).orientation == Orientation.portrait) ? 2 : 3;
return new SingleChildScrollView( return new Semantics(
scopesRoute: true,
namesRoute: true,
label: 'categories',
explicitChildNodes: true,
child: new SingleChildScrollView(
key: const PageStorageKey<String>('categories'), key: const PageStorageKey<String>('categories'),
child: new LayoutBuilder( child: new LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {
...@@ -151,6 +156,7 @@ class _CategoriesPage extends StatelessWidget { ...@@ -151,6 +156,7 @@ class _CategoriesPage extends StatelessWidget {
); );
}, },
), ),
),
); );
} }
} }
...@@ -240,6 +246,11 @@ class _DemosPage extends StatelessWidget { ...@@ -240,6 +246,11 @@ class _DemosPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new KeyedSubtree( return new KeyedSubtree(
key: const ValueKey<String>('GalleryDemoList'), // So the tests can find this ListView key: const ValueKey<String>('GalleryDemoList'), // So the tests can find this ListView
child: new Semantics(
scopesRoute: true,
namesRoute: true,
label: category.name,
explicitChildNodes: true,
child: new ListView( child: new ListView(
key: new PageStorageKey<String>(category.name), key: new PageStorageKey<String>(category.name),
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
...@@ -247,6 +258,7 @@ class _DemosPage extends StatelessWidget { ...@@ -247,6 +258,7 @@ class _DemosPage extends StatelessWidget {
return new _DemoItem(demo: demo); return new _DemoItem(demo: demo);
}).toList(), }).toList(),
), ),
),
); );
} }
} }
......
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