Skip to content

Commit f81873e

Browse files
committed
wrap materialbanner in semantics and place helpertext on InputDecoration
1 parent fc7ef5b commit f81873e

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

packages/authenticator/amplify_authenticator/lib/src/mixins/authenticator_text_field.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ mixin AuthenticatorTextField<
204204
suffixIcon: suffix,
205205
errorMaxLines: errorMaxLines,
206206
hintText: hintText,
207+
// Workaround for Flutter issue where validation errors are not
208+
// announced by screen readers on web unless helperText is set.
209+
// See: https://github.com/flutter/flutter/issues/99715
210+
helperText: ' ',
207211
),
208212
maxLength: maxLength,
209213
maxLengthEnforcement: MaxLengthEnforcement.enforced,

packages/authenticator/amplify_authenticator/lib/src/widgets/authenticator_banner.dart

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ MaterialBanner createMaterialBanner(
2525
key: keyAuthenticatorBanner,
2626
backgroundColor: colorsChoices.background,
2727
leading: Icon(type.icon, color: colorsChoices.foreground),
28-
content: Center(
29-
child: Row(
30-
crossAxisAlignment: CrossAxisAlignment.center,
31-
children: [
32-
Expanded(
33-
child: Text(
34-
message.trim(),
35-
style: TextStyle(color: colorsChoices.foreground),
28+
content: Semantics(
29+
liveRegion: true,
30+
child: Center(
31+
child: Row(
32+
crossAxisAlignment: CrossAxisAlignment.center,
33+
children: [
34+
Expanded(
35+
child: Text(
36+
message.trim(),
37+
style: TextStyle(color: colorsChoices.foreground),
38+
),
3639
),
37-
),
38-
],
40+
],
41+
),
3942
),
4043
),
4144
actions: [
@@ -70,18 +73,21 @@ SnackBar createSnackBar(
7073
return SnackBar(
7174
key: keyAuthenticatorBanner,
7275
backgroundColor: colorsChoices.background,
73-
content: Row(
74-
crossAxisAlignment: CrossAxisAlignment.center,
75-
children: [
76-
Icon(type.icon, color: fallbackIconColor),
77-
const SizedBox(width: 16),
78-
Expanded(
79-
child: Text(
80-
message.trim(),
81-
style: TextStyle(color: colorsChoices.foreground),
76+
content: Semantics(
77+
liveRegion: true,
78+
child: Row(
79+
crossAxisAlignment: CrossAxisAlignment.center,
80+
children: [
81+
Icon(type.icon, color: fallbackIconColor),
82+
const SizedBox(width: 16),
83+
Expanded(
84+
child: Text(
85+
message.trim(),
86+
style: TextStyle(color: colorsChoices.foreground),
87+
),
8288
),
83-
),
84-
],
89+
],
90+
),
8591
),
8692
);
8793
}

0 commit comments

Comments
 (0)