0

Accessibility talkback skipping some of the items in RecyclerView with the Staggered layout manager.

Steps to reproduce the issue:

  1. Run the project on any device (Verified in Samsung s10)
  2. Enable Accessibility talkback in the device. Settings->Accessibility->Screen Reader->Voice Assistant
  3. Do forward accessibility on the recycler view
  4. Observe Some of the items are skipped

Recycler layout file:

<?xml version="1.0" encoding="utf-8"?>

<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nestedScrollView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        tools:context=".MainActivity">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:importantForAccessibility="no"
            android:orientation="horizontal">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/page_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="50dp"
                android:nestedScrollingEnabled="true"
                app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager" />
        </LinearLayout>

    </LinearLayout>

</androidx.core.widget.NestedScrollView>

Recycler Layout file:

<?xml version="1.0" encoding="utf-8"?>

<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:padding="20dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/item_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            android:textAppearance="@style/TextAppearance.Material3.TitleMedium" />

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/item_image"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:scaleType="fitCenter" />

    </LinearLayout>

</com.google.android.material.card.MaterialCardView>

Find Screenshot here: https://i.stack.imgur.com/yUEFp.jpg

Sample project and screen record available here: https://issuetracker.google.com/issues/255525862

John Ruban Singh
  • 1,284
  • 14
  • 19

0 Answers0