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

TextContrastCheck not handling TextInputLayout.boxStrokeColor correctly

Open
#75 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

A false positive warning by TextContrastCheck is observed when using TextInputLayout from `com.google.android.material:material`. The check treats box stroke color as a foreground color. By default the box stroke color is transluscent, making it likely to trigger the warning.

### Reproduction

Given a blank project from Android Studio's _Empty Activity_ template and the following layout:

```xml

```

A warning is produced with the following output:

#### 📝 accessibility-test-framework 4.1.1
> AccessibilityViewCheckResult check=AccessibilityHierarchyCheckResult WARNING TextContrastCheck 11 [ViewHierarchyElement class=com.google.android.material.textfield.TextInputEditText bounds=Rect(0, 96 - 1080, 423)] {KEY_BACKGROUND_COLOR=-67585, KEY_CONTRAST_RATIO=4.33, KEY_FOREGROUND_COLOR=-8817538, KEY_IS_LARGE_TEXT=false, KEY_REQUIRED_CONTRAST_RATIO=4.5} num_answers:0 view=com.google.android.material.textfield.TextInputEditText{2f293a2 VFED..CL. ........ 0,0-936,167}

#### 📝 Accessibility Scanner 2.4.1.58312255

Accessibility Scanner resultShare text



The following is a list of opportunities to improve the accessibility of My Application. Each item corresponds to an outlined area on the attached screenshot.

Contrast tekst
[72,184][1008,351]
Overweeg de contrastverhouding tussen de voorgrond en achtergrond van deze afbeeldingstekst te verhogen.
De contrastverhouding van de itemtekst is 4,33. Deze verhouding is gebaseerd op de geschatte voorgrondkleur #79747E en de geschatte achtergrondkleur #FEF7FF. Overweeg de contrastverhouding van de itemtekst te verhogen naar 4,50 of hoger.

*For some reason the share text mixes English and Dutch? 🙈 Out of scope.

### Negative case

Overriding the default box stroke color with a high contrast color, the warning disappears.

| Layout | Accessibility Scanner result |
|-|-|
| | |

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.