Status Update
Comments
jn...@google.com <jn...@google.com>
jn...@google.com <jn...@google.com> #2
Thanks for the bug report - agree this looks wrong - will look to correct and patch into next 1.0.0 release.
jn...@google.com <jn...@google.com> #3
Looking at this further the background is being set to Color.Transparent, but with an alpha effect applied. So Color.Transparent.copy(alpha = ContentAlpha.disabled) is interestingly not transparent at all, which is not immediately intuitive to me. As a result the disabled background state of the Child Chip is showing a shim over the background color. See attached with a background color of Color.Green forced.
The workaround suggested by the original bug reporter (explicitly setting the disabledBackground to Color.Transparent - without an Alpha treatment) works - so applying it.
jn...@google.com <jn...@google.com> #4
Screenshot attached
jn...@google.com <jn...@google.com>
di...@gmail.com <di...@gmail.com> #5
I agree, the behaviour was not intuitive to me either. Another way could be applying min(background.alpha, disabled.alpha) in chipColors()
but that would have a much wider impact.
Thank you for the fix!
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit ff6fae95f64c40e7d75bfc0180d940dff28556fa
Author: John Nichol <jnichol@google.com>
Date: Wed Jul 13 14:19:51 2022
Explicitly set the disabledBackgroundColor for Chip childChipColors
Bug: 238057342
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
RelNote: "Fixed a bug in the ChipDefaults.childChipColor() to ensure that the disabled background color is full transparent."
Change-Id: I2b3c3ffdf046b9202e56411160ad41a51a1c6fb7
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ChipTest.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Chip.kt
Description
Component used: androidx.wear.compose:compose-material Version used: 1.0.0-rc02 Devices/Android versions reproduced on: All
Chip.kt childChipColors intends for the background to be transparent, but the disabled state overrides the alpha value, causing the background to appear a dark black instead of transparent.
Chip.kt childChipColors contains this code:
It should also override disabledBackgroundColor, also setting it to Color.Transparent. The default is
disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled),
which results in a dark black background for the chip.