material-components / material-components/material-components-android
TextInputLayout outline mode does not support dynamic boxBackgroundColor via ColorStateList
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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