Unverified Commit 58e57504 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Persistent BottomSheet are not dismissible via a11y (#107435)

parent 4ef6b817
...@@ -2182,7 +2182,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2182,7 +2182,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
), ),
); );
}, },
true, isPersistent: true,
animationController: animationController, animationController: animationController,
); );
} }
...@@ -2225,8 +2225,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2225,8 +2225,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
} }
PersistentBottomSheetController<T> _buildBottomSheet<T>( PersistentBottomSheetController<T> _buildBottomSheet<T>(
WidgetBuilder builder, WidgetBuilder builder, {
bool isPersistent, { required bool isPersistent,
required AnimationController animationController, required AnimationController animationController,
Color? backgroundColor, Color? backgroundColor,
double? elevation, double? elevation,
...@@ -2412,7 +2412,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2412,7 +2412,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
setState(() { setState(() {
_currentBottomSheet = _buildBottomSheet<T>( _currentBottomSheet = _buildBottomSheet<T>(
builder, builder,
false, isPersistent: false,
animationController: controller, animationController: controller,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
elevation: elevation, elevation: elevation,
...@@ -3165,7 +3165,7 @@ class _StandardBottomSheetState extends State<_StandardBottomSheet> { ...@@ -3165,7 +3165,7 @@ class _StandardBottomSheetState extends State<_StandardBottomSheet> {
}, },
child: Semantics( child: Semantics(
container: true, container: true,
onDismiss: close, onDismiss: !widget.isPersistent ? close : null,
child: NotificationListener<DraggableScrollableNotification>( child: NotificationListener<DraggableScrollableNotification>(
onNotification: extentChanged, onNotification: extentChanged,
child: BottomSheet( child: BottomSheet(
......
...@@ -2599,6 +2599,28 @@ void main() { ...@@ -2599,6 +2599,28 @@ void main() {
final ErrorSummary summary = error.diagnostics.first as ErrorSummary; final ErrorSummary summary = error.diagnostics.first as ErrorSummary;
expect(summary.toString(), 'The showSnackBar() method cannot be called during build.'); expect(summary.toString(), 'The showSnackBar() method cannot be called during build.');
}); });
testWidgets('Persistent BottomSheet is not dismissible via a11y means', (WidgetTester tester) async {
final Key bottomSheetKey = UniqueKey();
await tester.pumpWidget(MaterialApp(
home: Scaffold(
bottomSheet: Container(
key: bottomSheetKey,
height: 44,
color: Colors.blue,
child: const Text('BottomSheet'),
),
),
));
expect(
tester.getSemantics(find.byKey(bottomSheetKey)),
// Having the redundant argument value makes the intent of the test clear.
// ignore: avoid_redundant_argument_values
matchesSemantics(label: 'BottomSheet', hasDismissAction: false),
);
});
} }
class _GeometryListener extends StatefulWidget { class _GeometryListener extends StatefulWidget {
......
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