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

Commit 41fceb46 authored by Svetoslav's avatar Svetoslav
Browse files

Accessibilty: Cannot click on views in a scrollable container covered by the toolbar.

In accessibility mode we calculate a point where to click in the accessibility
focused view as a bridge-gap solution before switching to accessibility click
actions. We cannot detect whether a view is covered by another one that consumes
all touch events, and therefore we may click on the wrong target. This was the
case with the toolbar. As a result a partially scrolled view in a scrollable
container covered by a toolbar cannot be activated and this is not an edge case.

bug:18986806

Change-Id: Ib41470c39806cec13e9b00b319879cd7f3412ab5
parent 76ff4dd0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -829,8 +829,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        // Clip the bounds by our bounds.
        bounds.left = Math.max(bounds.left, 0);
        bounds.top = Math.max(bounds.top, 0);
        bounds.right = Math.min(bounds.right, mRight);
        bounds.bottom = Math.min(bounds.bottom, mBottom);
        bounds.right = Math.min(bounds.right, getWidth());
        bounds.bottom = Math.min(bounds.bottom, getHeight());

        Iterator<View> iterator = obtainOrderedChildIterator();
        while (iterator.hasNext()) {
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.app.ActionBar;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
@@ -1096,6 +1097,18 @@ public class Toolbar extends ViewGroup {
        return true;
    }

    /**
     * @hide
     */
    @Override
    public void addClickableRectsForAccessibility(List<RectF> outRects) {
        // This class always consumes touch events, therefore if it
        // covers a view we do not want to send a click over it.
        RectF bounds = new RectF();
        bounds.set(0, 0, getWidth(), getHeight());
        outRects.add(bounds);
    }

    /**
     * @hide
     */
+15 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Outline;
import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ActionMode;
@@ -31,6 +32,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import java.util.List;

/**
 * This class acts as a container for the action bar view and action mode context views.
 * It applies special styles as needed to help handle animated transitions between them.
@@ -224,6 +227,18 @@ public class ActionBarContainer extends FrameLayout {
        return true;
    }

    /**
     * @hide
     */
    @Override
    public void addClickableRectsForAccessibility(List<RectF> outRects) {
        // This class always consumes touch events, therefore if it
        // covers a view we do not want to send a click over it.
        RectF bounds = new RectF();
        bounds.set(0, 0, getWidth(), getHeight());
        outRects.add(bounds);
    }

    @Override
    public boolean onHoverEvent(MotionEvent ev) {
        super.onHoverEvent(ev);