https://kotlinlang.org logo
#compose
Title
# compose
r

Rick Regan

01/16/2022, 10:26 PM
If I swipe a
Button
(Material 2 or 3) I get a ripple but no
onClick
-- is that working as designed? (Unfortunately, button presses from my thumb when working one-handed tend to be swipes. )
z

Zach Klippenstein (he/him) [MOD]

01/17/2022, 2:08 AM
I think that is expected. Are these presses recognized as clicks with android views? Compose should be using the same touch slop as framework views.
r

Rick Regan

01/17/2022, 3:09 AM
I don't have my own code that uses Views but I just tried out some Buttons (or what I assume are Buttons) in several Google apps on my phone. Calculator and Clock do the same thing (swipe with ripple and no action) but Podcasts, Maps, and Play do not (swipe with ripple and action). (I don't know if any of those use Compose Buttons.)
a

Albert Chang

01/17/2022, 4:41 AM
It depends on whether the position you lift your finger is within the bounds of the button. This behavior is consistent between the view system and compose ui.
r

Rick Regan

01/17/2022, 4:03 PM
Thanks. I can see that behavior clearly in Compose when I make a big test Button.  If that’s standard Android behavior I won’t concern myself, although it takes getting used to. (For small, e.g. 48.dp buttons, the “ripple no action” happens fairly often, unless presses are slower and more deliberate.)
4 Views