fix(#638): announce the toast to screen readers

SnackBar wraps its content in Semantics(container, liveRegion, onDismiss)
(snack_bar.dart); the overlay replacement had no Semantics at all, so a
screen-reader user got silence where the message used to be announced.
Mirror the SnackBar wrapper.

Agent: TurquoiseBridge (session 82d77b2f)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dev
diffwireauto 22 hours ago committed by Benjamin Wiechel
parent 64978061ea
commit ae5676741e

@ -174,30 +174,38 @@ class _TopToastHostState extends State<_TopToastHost>
),
child: FadeTransition(
opacity: _controller,
child: Material(
color: background,
elevation: 6,
borderRadius: BorderRadius.circular(8),
clipBehavior: Clip.antiAlias,
// One recognizer for both gestures: a nested InkWell would
// also splash on the tap-up that ends a dismissing swipe.
child: GestureDetector(
onTap: _dismiss,
onVerticalDragEnd: (details) {
if ((details.primaryVelocity ?? 0) < 0) {
_dismiss();
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
child: DefaultTextStyle(
style: textStyle,
child: IconTheme(
data: IconThemeData(color: textStyle.color),
child: widget.child,
// Parity with SnackBar, which wraps its content the same way
// (snack_bar.dart): without liveRegion a screen reader never
// announces the message at all.
child: Semantics(
container: true,
liveRegion: true,
onDismiss: _dismiss,
child: Material(
color: background,
elevation: 6,
borderRadius: BorderRadius.circular(8),
clipBehavior: Clip.antiAlias,
// One recognizer for both gestures: a nested InkWell would
// also splash on the tap-up that ends a dismissing swipe.
child: GestureDetector(
onTap: _dismiss,
onVerticalDragEnd: (details) {
if ((details.primaryVelocity ?? 0) < 0) {
_dismiss();
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
child: DefaultTextStyle(
style: textStyle,
child: IconTheme(
data: IconThemeData(color: textStyle.color),
child: widget.child,
),
),
),
),

Loading…
Cancel
Save

Powered by TurnKey Linux.