diff options
| author | 2024-03-07 19:20:37 +0000 | |
|---|---|---|
| committer | 2024-03-12 20:35:11 +0000 | |
| commit | 28912453609aed85b7ba1c8dcac309908aae63e9 (patch) | |
| tree | c706190ff79610bf837f234bc47e31074c28253a | |
| parent | ef10f0dc6d00af72c8455a2f767494324b58b42f (diff) | |
Fix for accessibility focus in custom snackbar
the FAB produces a custom snackbar on dismissal, upon which an erroneous UI element can become focused in talkback and produce confusing text output.
By correctly flagging the non-interactive parts of the FAB's hierarchy, we should be able to prevent this from occurring.
Test: Dismiss the FAB while talkback is active. Focus should not shift to an unexpected element.
Flag: aconfig FLOATING_MENU_DRAG_TO_HIDE DISABLED
Bug: 322855605
Change-Id: I05ea3e16adc97a0ce88adcdc0149bb9c2bfe3463
4 files changed, 19 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/DragToInteractView.kt b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/DragToInteractView.kt index 0ef3d200d1fa..a90d4b2b6061 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/DragToInteractView.kt +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/DragToInteractView.kt @@ -118,6 +118,12 @@ class DragToInteractView(context: Context) : FrameLayout(context) { iconResId = R.drawable.pip_ic_close_white ) ) + + // Ensure this is unfocusable & uninteractable + isClickable = false + isFocusable = false + importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO + // END DragToInteractView modification } diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java index e57323b81490..35fe6b14ee28 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java @@ -74,6 +74,12 @@ class MenuMessageView extends LinearLayout implements addView(mTextView, Index.TEXT_VIEW, new LayoutParams(/* width= */ 0, WRAP_CONTENT, /* weight= */ 1)); addView(mUndoButton, Index.UNDO_BUTTON, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); + + // The message box is not focusable, but will announce its contents when it appears. + // The textView and button are still interactable. + setClickable(false); + setFocusable(false); + setAccessibilityLiveRegion(ACCESSIBILITY_LIVE_REGION_POLITE); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java index 577bbc0bd840..986391791b2c 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java @@ -101,6 +101,10 @@ class MenuView extends FrameLayout implements loadLayoutResources(); addView(mTargetFeaturesView); + + setClickable(false); + setFocusable(false); + setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java index cd3b8a68fb48..983ec2adbe91 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java @@ -319,6 +319,9 @@ class MenuViewLayer extends FrameLayout implements if (Flags.floatingMenuAnimatedTuck()) { setClipChildren(true); } + setClickable(false); + setFocusable(false); + setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } @Override |