Repository navigation
[Android] Semantics live region announces when a dialog is closed (even if the content is unchanged) #166258
Copy link
Copy link
Open
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: huggsy (g3)found in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.31Found to occur in 3.31Found to occur in 3.31has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)Owned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility teamTriaged by Framework Accessibility team
Description
Steps to reproduce
Internal bug b/366026080 (original context) and b/410014109 (outstanding work).
- Open a dialog while a live region is on screen
- Close the dialog
Expected results
Live region should only announce if its contents changed
Actual results
Live region announces every time, regardless of whether its content changed
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: false),
title: 'Flutter Demo',
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() async {
final value = await showDialog<bool>(
context: context,
builder:
(context) => AlertDialog(
content: const Text('Are you sure?'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text('Yes'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: const Text('No'),
),
],
),
);
if (mounted && value != null && value) {
setState(() {
_counter++;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title, style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Semantics(
liveRegion: true,
child: Text(
'Button tapped $_counter time${_counter == 1 ? '' : 's'}.',
key: Key('CountText'),
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
https://drive.google.com/file/d/12j3ppTHzd_LrmU3MqsDU0xIfXP1nWZfO/view
When I click "yes", the text view increments and correctly announces. But when I click "no" or the dialog scrim, it announces even though the text hasn't changed.
Logs
N/A, google internal client
Flutter Doctor output
N/A, google internal client
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: huggsy (g3)found in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.31Found to occur in 3.31Found to occur in 3.31has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)Owned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility teamTriaged by Framework Accessibility team
Type
Projects
- StatusShow more project fieldsNo status
Activity
math1man commentedon Mar 31, 2025
This issue is incredibly urgent due to https://developer.android.com/about/versions/16/behavior-changes-all#disruptive-a11y
maheshj01 commentedon Mar 31, 2025
Reproducible on latest stable and the master channel. The main Screen content is always announced on dialog close
Unmute for Audio
Screen.Recording.2025-03-31.at.18.19.48.mov
flutter doctor -v
master
stable
1 remaining item
chunhtai commentedon Apr 2, 2025
In native Android, navigate to a route through push and pop will re-announce the live region, but dialog won't.
so it looks like there is some work we need to do in flutter since route and dialog are treated the same in flutter.
Right now, a route will use BlockSemantics widget to hide the semantics for the route below, so navigating to a page will sends a new tree of semantics nodes to the android. Android will see a new live region node is created and announce it.
To properly fix this issue, the PopupRoute's modal barrier can't use blocksemantics, but instead having a way to make the semantics node of previous route unfocusable. This may depend on #165857
math1man commentedon Apr 8, 2025
Is it true that push-pop announces a live region on native Android? That's surprising to me.
chunhtai commentedon Apr 22, 2025
@math1man yes, I tested by push a new fragment and pop.
chunhtai commentedon Jul 29, 2025
blocked on #165857
jmagman commentedon Jan 9, 2026
Note #165857 is now fixed (thank you @hannah-hyj !).
hannah-hyj commentedon Mar 19, 2026
This live region re-announcement issue requires a non-trivial fix, we need to refactor or replace the BlockSemantics to fix the underlying semantics tree issue , I wrote a design doc for this issue: https://docs.google.com/document/d/1niJnShCR3-PIMYo1a9lWdVySBqr_wmXYPvBXntvcc0c/edit?tab=t.0 and will start the work once the design is approved.
flutter-triage-bot commentedon Jul 23, 2026
This issue is assigned to @hannah-hyj but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!