https://kotlinlang.org logo
Title
b

Bryan Herbst

02/02/2022, 9:45 PM
I’m struggling with accessibility behavior for buttons in my app. None of my Compose buttons are reading “Button” with the text in TalkBack. I can’t reproduce this in a different app, it seems to just be my app (currently on 1.0.5). A few interesting things I’ve discovered trying to track this down: • When printing the node tree from TalkBack, the buttons show up as
Button:invisible
, which I strongly suspect is the core reason this isn’t working. Digging into TalkBack source, this should only happen when
AccessibilityNodeInfo.isVisibleToUser
is false. • I set some breakpoints in
AndroidComposeViewAccessibilityDelegateCompat
, and as best as I can tell the node info has
isVisibleToUser
correctly set to true, and I do see the correct role showing up here for the buttons What are some things that could cause this? I’ve tried replacing my design systems’ buttons with Material buttons, I’ve tried moving the composables out of Fragments and into the Activity, I’ve tried removing all other content in case something else on the screen was confusing TalkBack, all with no success. I’d love to file a bug, but since I can’t reproduce it outside my application I don’t have much more to provide.
Here’s the node tree with the invisible button at the end
a

Arjun Achatz

02/03/2022, 1:36 AM
What device are you testing this on ?
b

Bryan Herbst

02/03/2022, 2:23 PM
Currently a Pixel 5
Updating to Compose 1.1.0-rc03 fixed it 🤷‍♂️