I have no idea how it works on Android, so posting here, but it could be generic problem. In modern ...
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