Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TalkBack focuses behind a transparent layer

I have a transparent view in my app on top of a few fragments. So my fragments are below the transparent overlay, but they are not reachable by the user while the overlay is opened, as touching the overlay will dismiss it. All work fine up to the point when I enable TalkBack

My problem is that when I have TalkBack enabled and I swipe to select the next element, once TalkBack has finished with everything in the overlay, it will start setting focus on items below overlay. Is there any way to stop it from doing so? Something similar to the android:clickable="true" or using an onClick listener for making the transparent overlay intercept all clicks?

like image 378
vkislicins Avatar asked Dec 07 '15 18:12

vkislicins


1 Answers

On API 19+, you can set the accessibility importance of root view of the hierarchy that you want to hide from TalkBack to be NO_HIDE_DESCENDANTS. This will prevent TalkBack from focusing anything in that hierarchy, and this is how we handle the navigation drawer scrim.

On previous versions, there's no good way to accomplish this. There are some bad ways involving manually hiding nodes from the AccessibilityNodeInfo for the root view, though, and you can check those in the DrawerLayout source code.

like image 62
alanv Avatar answered Sep 28 '22 06:09

alanv