Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

TalkBack focuses on obscured views of the list pane when the details pane is open. #37

Open
illarionov opened this issue Sep 12, 2021 · 0 comments

Comments

@illarionov
Copy link

Android 11, Samsung SM-G770F/DS, TalkBack 12.5.01.2

Open task detail from the task list screen and explore the opened screen with TalkBack turned on.
Besides the elements of the details page, TalkBack will also focus on the hidden views of the task list screen:

Screenshot_20210912-023246_Trackr_2

i think this is a bug in SlidingPaneLayout library. Until it is fixed, as a workaround we can set importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS on the hidden pane of the SlidingPaneLayout. Something like this:

--- a/app/src/main/java/com/example/android/trackr/ui/BaseTwoPaneFragment.kt
        slidingPaneLayout.addPanelSlideListener(SlidingPaneAccessibilityHandler(slidingPaneLayout))

internal class SlidingPaneAccessibilityHandler(private val slidingPaneLayout: SlidingPaneLayout) : PanelSlideListener {

    private val listPaneContent by lazy(NONE) {
        slidingPaneLayout.findViewById<ViewGroup>(R.id.list_pane)[0]
    }

    init {
        slidingPaneLayout.doOnLayout {
            syncState()
        }
    }

    private fun syncState() {
        val mode = if (slidingPaneLayout.isSlideable && slidingPaneLayout.isOpen) {
            View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
        } else {
            View.IMPORTANT_FOR_ACCESSIBILITY_AUTO
        }
        listPaneContent.importantForAccessibility = mode
    }
    override fun onPanelOpened(panel: View) {
        syncState()
    }

    override fun onPanelClosed(panel: View) {
        syncState()
    }

    override fun onPanelSlide(panel: View, slideOffset: Float) {
        // empty
    }
}

This snippet fixes the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant