material-components / material-components/material-components-android

TextInputLayout outline mode does not support dynamic boxBackgroundColor via ColorStateList

Open
#4,958 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: TextField
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

### Issue Summary
When using `TextInputLayout` with `boxBackgroundMode="outline"`, the `boxBackgroundColor` does not respond to `ColorStateList` changes. This makes it impossible to change the background color dynamically on focus, unlike `filled` mode which works as expected.

### Steps to Reproduce
1. Create a selector color resource with `state_focused` and default.
2. Set it to `app:boxBackgroundColor` in XML.
3. Use `boxBackgroundMode="outline"`.

### Expected Behavior
The background color of the outlined box should change when focused.

### Actual Behavior
Only the default color is applied. Focused state is ignored.

### Environment
- Material Components version: [your version]
- Android version: [your device/emulator]
- Theme: Material3 / Material2

### Additional Notes
This behavior is inconsistent with `filled` mode and limits UI flexibility. Please consider adding support for `ColorStateList` in outline mode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with TextInputLayout in outline mode and a selector ColorStateList containing focused and default colors. Inspect the outline background-color handling and compare it with filled mode; done means the outlined box changes color when focus changes, with coverage for both states.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.