https://kotlinlang.org logo
Title
m

marios proto

03/21/2022, 1:42 PM
👋 I have updated to compose 1.1.1 and together the compose.material to 1.1.1, but since then , in a button in my app there is some change on the way an OutlineButton is rendered. so from this, it ended up as this. Anything known issue on this? the code is quite basic
OutlinedButton(
    onClick = actionClick,
    enabled = enabled,
    colors = buttonColors,
    modifier = modifier
        .border(
            border = BorderStroke(
                width = 1.dp,
                color = if (enabled) borderColor else disabledColor
            ),
            shape = RoundedCornerShape(4.dp),
        )
) {
    Text(
        text = actionText.uppercase(),
        textAlign = TextAlign.Center,
        style = CompanyTheme.typography.body,
        maxLines = 1,
        modifier = Modifier.semantics {
            contentDescription = actionContentDescription
        }
    )
}
f

f.babic

03/21/2022, 1:44 PM
Not an issue I think - it might be tied to the decision to push the material components to be at least 36dp (for accessibility). So basically if your components are smaller than that, Compose will add padding/a larger touch area to make it larger and easier to interact with. It's a bit annoying, because it means that an internal change has UI impacts on your code whether or not you want it. But in the end, it's connected to accessibility and surely helps people use the UI, so it's mostly a positive change.
m

marios proto

03/21/2022, 1:49 PM
I read about this thank you. Is there any way to override this behaviour?
from the impl of Button in material it seems it is not possible
f

f.babic

03/21/2022, 2:11 PM
yeah I think it's not - you could use simple buttons etc and not the material ones
m

marios proto

03/21/2022, 2:14 PM
It seems as the only solution now, yes. Thank you for your help
❤️ 1
c

Chris Sinco [G]

03/21/2022, 5:09 PM
This is the CompositionLocal that allows overriding it for multiple elements: https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#LocalMinimumTouchTargetEnforcement()
🙌 1
:thank-you: 1
But as mentioned before, this change was to encourage minimum touch targets for UI components, remove/opt-out with caution
👍 1
🙌 1
m

marios proto

03/21/2022, 7:57 PM
thank you! I had already ran into that, looks kind of hidden to use, for a good reason 😉
🙂 1