Skip to content

Commit 85b3d97

Browse files
authored
fix(flutter/a11y assessments): h1 missing a11y from each page on the web app (flutter#152198)
Adds Semantic Widget to wrap the contents of each page's AppBar title attribute and adds header: true and headingLevel: 1 as Semantic attributes so the content of the title is compiled as an h1 tag to meet accessibility guidelines that each page must have a h1 tag present. Also updates the test cases for the home page and each use case page to check for its respective h1. [Before Screenshot - Accessibility Assessments Home Page](https://screenshot.googleplex.com/4i9LuiGwvLnEcZ8) [Before Screenshot - Checkbox List Title -- note: each use case page is missing an h1](https://screenshot.googleplex.com/3qQjfqvAMTehRsm) [After Screenshot - Accessibility Assessments Home Page](https://screenshot.googleplex.com/APSJJXBmwNBP35m) [After Screenshot - Checkbox List Title-- note: change is similar across each Accessibility use case page](https://screenshot.googleplex.com/6EGgZnTusEgeN5L) Fixes b/338035526
1 parent 87abed2 commit 85b3d97

35 files changed

+132
-20
lines changed

dev/a11y_assessments/lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class HomePageState extends State<HomePage> {
7777
@override
7878
Widget build(BuildContext context) {
7979
return Scaffold(
80-
appBar: AppBar(title: const Text('Accessibility Assessments')),
80+
appBar: AppBar(
81+
title: Semantics(headingLevel: 1, child: const Text('Accessibility Assessments')),
82+
),
8183
body: Center(
8284
child: ListView(
8385
controller: scrollController,

dev/a11y_assessments/lib/use_cases/action_chip.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MainWidgetState extends State<MainWidget> {
3131
return Scaffold(
3232
appBar: AppBar(
3333
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
34-
title: const Text('ActionChip'),
34+
title: Semantics(headingLevel:1, child: const Text('ActionChip')),
3535
),
3636
body: Center(
3737
child: Column(

dev/a11y_assessments/lib/use_cases/auto_complete.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class _MainWidgetState extends State<_MainWidget> {
5050
return Scaffold(
5151
appBar: AppBar(
5252
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
53-
title: const Text('AutoComplete'),
53+
title: Semantics(headingLevel: 1, child: const Text('AutoComplete Demo')),
5454
),
5555
body: Center(
5656
child: Column(

dev/a11y_assessments/lib/use_cases/badge.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ class MainWidget extends StatefulWidget {
2525
}
2626

2727
class MainWidgetState extends State<MainWidget> {
28+
2829
@override
2930
Widget build(BuildContext context) {
3031
return Scaffold(
3132
appBar: AppBar(
3233
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
33-
title: const Text('Badge'),
34+
title: Semantics(headingLevel: 1, child: const Text('Badge Demo')),
3435
),
3536
body: const Center(
3637
child: Badge(

dev/a11y_assessments/lib/use_cases/card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MainWidgetState extends State<MainWidget> {
3131
return Scaffold(
3232
appBar: AppBar(
3333
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
34-
title: const Text('Card'),
34+
title: Semantics(headingLevel: 1, child: const Text('Card')),
3535
),
3636
body: const Center(
3737
child: Column(

dev/a11y_assessments/lib/use_cases/check_box_list_tile.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class _MainWidgetState extends State<_MainWidget> {
2828
@override
2929
Widget build(BuildContext context) {
3030
return Scaffold(
31-
appBar: AppBar(title: const Text('CheckBoxListTile')),
31+
appBar: AppBar(
32+
title: Semantics(headingLevel: 1, child: const Text('CheckBoxListTile Demo')),
33+
),
3234
body: ListView(
3335
children: <Widget>[
3436
CheckboxListTile(

dev/a11y_assessments/lib/use_cases/date_picker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class _MainWidgetState extends State<_MainWidget> {
3030
return Scaffold(
3131
appBar: AppBar(
3232
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
33-
title: const Text('DatePicker'),
33+
title: Semantics(headingLevel: 1, child: const Text('DatePicker Demo')),
3434
),
3535
body: Center(
3636
child: TextButton(

dev/a11y_assessments/lib/use_cases/dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class _MainWidget extends StatelessWidget {
2424
return Scaffold(
2525
appBar: AppBar(
2626
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
27-
title: const Text('Dialog'),
27+
title: Semantics(headingLevel: 1, child: const Text('Dialog Demo')),
2828
),
2929
body: Center(
3030
child: TextButton(

dev/a11y_assessments/lib/use_cases/drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class _DrawerExampleState extends State<DrawerExample> {
3131
Widget build(BuildContext context) {
3232
return Scaffold(
3333
appBar: AppBar(
34-
title: const Text('Drawer Example'),
3534
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
35+
title: Semantics(headingLevel: 1, child: const Text('Drawer Demo')),
3636
),
3737
endDrawer: Drawer(
3838
child: ListView(

dev/a11y_assessments/lib/use_cases/expansion_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class _ExpansionTileExampleState extends State<ExpansionTileExample> {
3232
return Scaffold(
3333
appBar: AppBar(
3434
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
35-
title: const Text('ExpansionTile'),
35+
title: Semantics(headingLevel: 1, child: const Text('ExpansionTile')),
3636
),
3737
body: Column(
3838
children: <Widget>[

0 commit comments

Comments
 (0)