google / google/Accessibility-Test-Framework-for-Android

SpeakableTextPresentCheck skipped on Compose IconButton

Open
#92 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
520
Forks
154
PR merge metrics
No merged PRs in 30d

Description

Hello,

When I use Compose `IconButton` without any content description (neither in the `IconButton` nor in the icon inside of it), ATF doesn't trigger any `SpeakableTextPresentCheck` error. **The check is skipped with reason `This item would not be focused by a screen reader.`**

I tried using a Box instead of IconButton and the check got properly triggered as error. So I took `IconButton` code and changed it piece by piece to understand what made the check get skipped. I figured out that **the culprit is the `Button` role**: if I use the same code as `IconButton` without the `Button` role the `SpeakableTextPresentCheck` triggers an error, if I keep the `Button` role it gets skipped.

I looked at ATF code to understand where exactly the skip decision was made. I found out that **`ViewHierarchyElement.importantForAccessibility` is false when the role is `Button`** and that's why it gets skipped.

Why is `importantForAccessibility` false when there's the `Button` role ? This doesn't make any sense, it should be exactly the opposite: the role `Button` indicates it's super important to have a speakable text here.

I can't remove the `Button` role because this would make my app less accessible. But with it I can't have any automatic check on IconButton without any speakable text, which is a huge violation of accessibility. What can I do to have this violation properly reported ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.