From e75ec0d6fdfd83cfc826b07fa3f7e2002d35706d Mon Sep 17 00:00:00 2001 From: Material Design Team Date: Thu, 26 Apr 2018 16:29:54 -0400 Subject: [PATCH] Transformation- Ignore the scrim when updating accessibility importance. The scrim is used to dismiss an expanded FAB, so this helps ensure that the scrim remains clickable with Switch Access and TalkBack after a FAB has been expanded. PiperOrigin-RevId: 194445155 --- .../transformation/FabTransformationSheetBehavior.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/java/com/google/android/material/transformation/FabTransformationSheetBehavior.java b/lib/java/com/google/android/material/transformation/FabTransformationSheetBehavior.java index 4d9abd604..5a0a60ffb 100644 --- a/lib/java/com/google/android/material/transformation/FabTransformationSheetBehavior.java +++ b/lib/java/com/google/android/material/transformation/FabTransformationSheetBehavior.java @@ -87,7 +87,13 @@ public class FabTransformationSheetBehavior extends FabTransformationBehavior { for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); - if (child == sheet) { + + // Don't change the accessibility importance of the sheet or the scrim. + boolean hasScrimBehavior = + (child.getLayoutParams() instanceof CoordinatorLayout.LayoutParams) + && (((CoordinatorLayout.LayoutParams) child.getLayoutParams()).getBehavior() + instanceof FabTransformationScrimBehavior); + if (child == sheet || hasScrimBehavior) { continue; }