It won't work with Button
because of the same reason you can't chain Modifier.clickable{}.clickable{}
With Button
adding another Modifier.pointerInput()
won't have any effect because Button
is a Surface
with onClick param that is assigned Modifier.clickable()
already. Modifier.clickable
already consumes events and not letting other Modifier.pointerInput()
receiving it.
In Jetpack Compose when there are two or more Modifier.pointerInput()
chained together the one at the bottom receives event first with default pass which isPointeEventPass.Main
. Since, clickable already consumes, the one you assign will never get it.
Simplest way is to create a Box, Surface uses Box under the hood, and set your combinedClickable
.
You can check out this answer for consume, event propagation and how gestures work under the hood if interested in details.
https://stackoverflow.com/a/70847531/5457853