Skip to content

Commit a12c9b7

Browse files
committed
accessibility: Add Semantics to loading indicators so screen readers announce loading
1 parent 9296fb3 commit a12c9b7

File tree

10 files changed

+76
-40
lines changed

10 files changed

+76
-40
lines changed

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "master"
3+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ app.*.map.json
5353

5454
# Old scaffolding hack
5555
lib/credential_fixture.dart
56+
57+
# FVM Version Cache
58+
.fvm/

.vscode/settings.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
// Visual Studio Code settings for the zulip-flutter repo.
21
{
3-
// VS Code formats files on save by default.
4-
// Like Flutter itself, we don't use the Dart autoformatter,
5-
// so disable that VS Code behavior.
62
"[dart]": {
7-
// This appears redundant with the all-language setting,
8-
// but it's not: if the user's personal config has a Dart-specific
9-
// setting, then we need a Dart-specific setting to override it.
103
"editor.formatOnSave": false,
114
"editor.formatOnType": false,
12-
"editor.formatOnPaste": false,
5+
"editor.formatOnPaste": false
136
},
14-
15-
// For that matter, don't go reformatting whole files in any language.
167
"editor.formatOnSave": false,
17-
18-
// This much more focused automatic fix is helpful, though.
198
"files.trimTrailingWhitespace": true,
20-
21-
// Suppress the warnings that appear for TODOs throughout the codebase.
229
"dart.showTodos": false,
23-
}
10+
"dart.flutterSdkPath": ".fvm/versions/master"
11+
}

lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ void main() {
1818
LiveZulipBinding.ensureInitialized();
1919
NotificationService.instance.start();
2020
ShareService.start();
21-
runApp(const ZulipApp());
21+
runApp(ZulipApp());
2222
}

lib/widgets/action_sheet.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,15 @@ class BottomSheetEmptyContentPlaceholder extends StatelessWidget {
255255
final designVariables = DesignVariables.of(context);
256256

257257
final child = loading
258-
? CircularProgressIndicator()
258+
? Semantics(
259+
260+
focusable: true,
261+
262+
liveRegion: true,
263+
264+
label: 'Loading…',
265+
child: CircularProgressIndicator(),
266+
)
259267
: Text(
260268
textAlign: TextAlign.center,
261269
style: TextStyle(

lib/widgets/home.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,12 @@ class _LoadingPlaceholderPageState extends State<_LoadingPlaceholderPage> {
246246
child: Column(
247247
mainAxisSize: MainAxisSize.min,
248248
children: [
249-
const CircularProgressIndicator(),
249+
Semantics(
250+
label: 'Loading…',
251+
liveRegion: true,
252+
child:const CircularProgressIndicator(),
253+
)
254+
,
250255
Visibility(
251256
visible: showTryAnotherAccount,
252257
maintainSize: true,

lib/widgets/message_list.dart

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,18 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
10291029
Widget build(BuildContext context) {
10301030
final zulipLocalizations = ZulipLocalizations.of(context);
10311031

1032-
if (!model.fetched) return const Center(child: CircularProgressIndicator());
1032+
if (!model.fetched) return Center(
1033+
child: Padding(
1034+
padding: const EdgeInsets.symmetric(vertical: 16.0),
1035+
child: Semantics(
1036+
label: 'Loading more messages',
1037+
// Tells TalkBack: this is important, announce it
1038+
liveRegion: true,
1039+
child: const CircularProgressIndicator(),
1040+
),
1041+
),
1042+
);
1043+
10331044

10341045
if (model.items.isEmpty && model.haveNewest && model.haveOldest) {
10351046
final String header;
@@ -1283,10 +1294,18 @@ class _MessageListLoadingMore extends StatelessWidget {
12831294

12841295
@override
12851296
Widget build(BuildContext context) {
1286-
return const Center(
1297+
return Center(
12871298
child: Padding(
1288-
padding: EdgeInsets.symmetric(vertical: 16.0),
1289-
child: CircularProgressIndicator())); // TODO perhaps a different indicator
1299+
padding: const EdgeInsets.symmetric(vertical: 16.0),
1300+
child: Semantics(
1301+
label: 'Loading more messages',
1302+
1303+
liveRegion: true,
1304+
child: const CircularProgressIndicator(),
1305+
),
1306+
),
1307+
);
1308+
// TODO perhaps a different indicator
12901309
}
12911310
}
12921311

lib/widgets/store.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,15 @@ class LoadingPlaceholder extends StatelessWidget {
355355

356356
@override
357357
Widget build(BuildContext context) {
358-
return const Center(child: CircularProgressIndicator());
358+
return Center(
359+
child: Semantics(
360+
label: 'Loading…',
361+
liveRegion: true,
362+
focusable: true,
363+
child: CircularProgressIndicator(),
364+
),
365+
);
366+
359367
}
360368
}
361369

lib/widgets/topic_list.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,17 @@ class _TopicListState extends State<_TopicList> with PerAccountStoreAwareStateMi
166166
@override
167167
Widget build(BuildContext context) {
168168
if (lastFetchedTopics == null) {
169-
return const Center(child: CircularProgressIndicator());
169+
return Center(
170+
child: Padding(
171+
padding: const EdgeInsets.symmetric(vertical: 16.0),
172+
child: Semantics(
173+
label: 'Loading…', // plain string (not localized)
174+
liveRegion: true,
175+
child: CircularProgressIndicator(),
176+
),
177+
),
178+
);
179+
170180
}
171181

172182
// TODO(design) handle the rare case when `lastFetchedTopics` is empty

pubspec.lock

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,6 @@ packages:
622622
url: "https://pub.dev"
623623
source: hosted
624624
version: "1.0.5"
625-
js:
626-
dependency: transitive
627-
description:
628-
name: js
629-
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
630-
url: "https://pub.dev"
631-
source: hosted
632-
version: "0.7.2"
633625
json_annotation:
634626
dependency: "direct main"
635627
description:
@@ -698,18 +690,18 @@ packages:
698690
dependency: transitive
699691
description:
700692
name: matcher
701-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
693+
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
702694
url: "https://pub.dev"
703695
source: hosted
704-
version: "0.12.17"
696+
version: "0.12.18"
705697
material_color_utilities:
706698
dependency: transitive
707699
description:
708700
name: material_color_utilities
709-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
701+
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
710702
url: "https://pub.dev"
711703
source: hosted
712-
version: "0.11.1"
704+
version: "0.13.0"
713705
meta:
714706
dependency: transitive
715707
description:
@@ -1079,10 +1071,10 @@ packages:
10791071
dependency: "direct dev"
10801072
description:
10811073
name: test
1082-
sha256: "8f0eb7fa76b7d05a4f3707e0dbd581babef5b0915ca508b757cf15d0cabb56cb"
1074+
sha256: "77cc98ea27006c84e71a7356cf3daf9ddbde2d91d84f77dbfe64cf0e4d9611ae"
10831075
url: "https://pub.dev"
10841076
source: hosted
1085-
version: "1.27.0"
1077+
version: "1.28.0"
10861078
test_api:
10871079
dependency: "direct dev"
10881080
description:
@@ -1095,10 +1087,10 @@ packages:
10951087
dependency: transitive
10961088
description:
10971089
name: test_core
1098-
sha256: bad9916601a4f2ef6e4dbc466fb712e4b42cf4917c3fd428b018f51984fce13b
1090+
sha256: f1072617a6657e5fc09662e721307f7fb009b4ed89b19f47175d11d5254a62d4
10991091
url: "https://pub.dev"
11001092
source: hosted
1101-
version: "0.6.13"
1093+
version: "0.6.14"
11021094
timing:
11031095
dependency: transitive
11041096
description:

0 commit comments

Comments
 (0)