Repository navigation
Conversation
…droid Fixes flutter/flutter#195050 DrawerController previously excluded the drawer scrim from the semantics tree on Android via platformHasBackButton. Flutter updated ModalBarrier to include the dismiss barrier on Android for Switch Access, but DrawerController's custom scrim was not updated. This removes the obsolete Android exclusion and sets excluding directly to !widget.drawerBarrierDismissible, allowing Android Switch Access users to dismiss the modal drawer without selecting a destination.
Contributor
There was a problem hiding this comment.
Code Review
This pull request exposes modal barrier dismiss semantics for Drawer on Android to support Switch Access by replacing platform-specific checks with a check on widget.drawerBarrierDismissible. Tests have been updated to run across all platforms to reflect this change. The review feedback suggests replacing hardcoded 'Dismiss' strings in the tests with const DefaultMaterialLocalizations().modalBarrierDismissLabel to ensure consistency with the framework's localizations.
…el in drawer tests Avoid hardcoding 'Dismiss' string in drawer barrier semantics tests.
Author
|
Addressed review feedback in 4c9c489: replaced hardcoded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a modal
DrawerorNavigationDraweropens on Android, Android Switch Access users could not dismiss the drawer without selecting a destination inside it.Root cause
In
DrawerControllerState._buildDrawer(packages/material_ui/lib/src/drawer.dart), the modal barrier scrim was explicitly excluded from the semantics tree on Android viaexcluding: platformHasBackButton:This exclusion originally existed under the assumption that Android users always use a physical or system Back button to dismiss modals. However, Flutter previously updated
ModalBarrierto support dismissing barriers on Android (TargetPlatform.androidsetsplatformSupportsDismissingBarrier = true), allowing Switch Access users to dismiss modal bottom sheets and dialogs via the scrim.DrawerController's custom scrim was not updated.Fix
platformHasBackButtoncheck inpackages/material_ui/lib/src/drawer.dart.excluding: !widget.drawerBarrierDismissibleso the dismiss barrier semantics is available on all platforms (including Android) whendrawerBarrierDismissibleis true (default), and excluded when false.drawer_test.dartto verify barrier dismiss semantics on all platform variants, and verify it is excluded whendrawerBarrierDismissibleis false.Fixes flutter/flutter#195050
Pre-Review Checklist
[shared_preferences]///).I used AI tooling while working on this, and reviewed and tested all of it myself.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2