Commit a752435f authored by Per Classon's avatar Per Classon Committed by Flutter GitHub Bot

Exclude modal barrier Container in Drawer from Semantics on Android (#48841)

parent 63016c89
...@@ -542,18 +542,20 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -542,18 +542,20 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
BlockSemantics( BlockSemantics(
child: GestureDetector( child: ExcludeSemantics(
// On Android, the back button is used to dismiss a modal. // On Android, the back button is used to dismiss a modal.
excludeFromSemantics: platformHasBackButton, excluding: platformHasBackButton,
onTap: close, child: GestureDetector(
child: Semantics( onTap: close,
label: MaterialLocalizations.of(context)?.modalBarrierDismissLabel, child: Semantics(
child: MouseRegion( label: MaterialLocalizations.of(context)?.modalBarrierDismissLabel,
opaque: true, child: MouseRegion(
child: Container( // The drawer's "scrim" opaque: true,
color: _scrimColorTween.evaluate(_controller), child: Container( // The drawer's "scrim"
color: _scrimColorTween.evaluate(_controller),
),
), ),
) ),
), ),
), ),
), ),
......
...@@ -328,6 +328,7 @@ void main() { ...@@ -328,6 +328,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(semantics, includesNodeWith(actions: <SemanticsAction>[SemanticsAction.tap])); expect(semantics, includesNodeWith(actions: <SemanticsAction>[SemanticsAction.tap]));
expect(semantics, includesNodeWith(label: 'Dismiss'));
semantics.dispose(); semantics.dispose();
...@@ -357,6 +358,7 @@ void main() { ...@@ -357,6 +358,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(semantics, isNot(includesNodeWith(actions: <SemanticsAction>[SemanticsAction.tap]))); expect(semantics, isNot(includesNodeWith(actions: <SemanticsAction>[SemanticsAction.tap])));
expect(semantics, isNot(includesNodeWith(label: 'Dismiss')));
semantics.dispose(); semantics.dispose();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment