Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28912453 authored by Riley Jones's avatar Riley Jones
Browse files

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
parent ef10f0dc
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -118,6 +118,12 @@ class DragToInteractView(context: Context) : FrameLayout(context) {
                iconResId = R.drawable.pip_ic_close_white
                iconResId = R.drawable.pip_ic_close_white
            )
            )
        )
        )

        // Ensure this is unfocusable & uninteractable
        isClickable = false
        isFocusable = false
        importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO

        // END DragToInteractView modification
        // END DragToInteractView modification
    }
    }


+6 −0
Original line number Original line Diff line number Diff line
@@ -74,6 +74,12 @@ class MenuMessageView extends LinearLayout implements
        addView(mTextView, Index.TEXT_VIEW,
        addView(mTextView, Index.TEXT_VIEW,
                new LayoutParams(/* width= */ 0, WRAP_CONTENT, /* weight= */ 1));
                new LayoutParams(/* width= */ 0, WRAP_CONTENT, /* weight= */ 1));
        addView(mUndoButton, Index.UNDO_BUTTON, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
        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
    @Override
+4 −0
Original line number Original line Diff line number Diff line
@@ -101,6 +101,10 @@ class MenuView extends FrameLayout implements
        loadLayoutResources();
        loadLayoutResources();


        addView(mTargetFeaturesView);
        addView(mTargetFeaturesView);

        setClickable(false);
        setFocusable(false);
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    }
    }


    @Override
    @Override
+3 −0
Original line number Original line Diff line number Diff line
@@ -319,6 +319,9 @@ class MenuViewLayer extends FrameLayout implements
        if (Flags.floatingMenuAnimatedTuck()) {
        if (Flags.floatingMenuAnimatedTuck()) {
            setClipChildren(true);
            setClipChildren(true);
        }
        }
        setClickable(false);
        setFocusable(false);
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    }
    }


    @Override
    @Override