From 01a9aec444911c183731dc30bbee4162919cd17d Mon Sep 17 00:00:00 2001 From: Wasmund1 Date: Thu, 30 Jan 2025 01:25:30 +0100 Subject: [PATCH] Drag handle semantic role (#161941) Adds semantic role button to ModalBottomSheet's DragHandle. https://github.com/flutter/flutter/issues/161430 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. Existing test was updated - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. No breaking changes - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: philip wasmund --- packages/flutter/lib/src/material/bottom_sheet.dart | 1 + packages/flutter/test/material/bottom_sheet_test.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index b2ed703acd..047478f806 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -458,6 +458,7 @@ class _DragHandle extends StatelessWidget { child: Semantics( label: MaterialLocalizations.of(context).modalBarrierDismissLabel, container: true, + button: true, onTap: onSemanticsTap, child: SizedBox( width: math.max(handleSize.width, kMinInteractiveDimension), diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 80d684484e..b8a111d2d2 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -1181,6 +1181,7 @@ void main() { textDirection: TextDirection.ltr, children: [ TestSemantics( + flags: [SemanticsFlag.isButton], actions: [SemanticsAction.tap], label: 'Dismiss', textDirection: TextDirection.ltr,