I have no idea how it works on Android, so posting...
# compose-desktop
o
I have no idea how it works on Android, so posting here, but it could be generic problem. In modern OSes when you push the button (but don’t release the mouse!), move cursors away from button it gets depressed, and if you release it, no click is registered. All fine here. But, if you don’t release mouse after moving away, and move cursor back into button area, it gets pressed back and if you release the mouse the click is registered. This is not working in Compose (desktop).
4
j
cc @Chris Sinco [G] for material design expectations.
c
From the Material Design POV, there doesn’t seem to be a clear spec for this with buttons.
👍 1
When playing with the components on Android (MDC-Android and Compose), it seems the behavior is that if you move your pressed finger away from the button, the pressed state is removed. When moving back, the pressed state does NOT come back, and the touch/tap event is not registered on release over the button.
👍 1
However, when playing with Material components that Google uses for Google products on desktop (web), the behavior mentioned is what happens there, which feels expected given it’s a desktop/mouse context.
👍 1
More interestingly, iOS actually does this similar behavior with desktop (learned that today), so it seems to be a decision Android made some time ago, and not necessarily Material Design.
👍 1
Overall, I would +1 that the behavior @orangy mentioned is what is expected from desktop buttons. However, I’m not technically capable of understanding if it’s something the Compose Android team should address versus Compose Desktop.
👍 1
k
I think the pressed state on Android was to show the tooltip for the button? Touch and drag off is what I do sometimes to see what an icon does.
r
Tooltips came later
Not retaining the pressed state makes more sense on a touch screen vs a mouse driven UI
👍 2
And this is indeed a behavior from the early days
👍 1
There are other things touch specific that Android does and not all of them are present in Compose
👍 2
For instance when you press a button, we always keep the pressed state for XXms
👍 1
Touch screens are very sensitive and without this enforced duration of the pressed state it can be hard to see that the button went into pressed state
👍 3
Compose doesn’t do this yet (@Adam Powell to check me on this)
👍 1
a
you're right, it's not there yet
👍 1
many discussions so far about making some of these behaviors tool-specific, e.g. finger vs. cursor
👆 2
👍 2
j
z
Quite interesting topic, how would that change on Android if we connect mouse? Will it be cursor or finger kind of experience? 🤔
t
To add to it: is there any plans to support 'custem' / further input types for devices like pens?
1
😉 1
👌 1