When using `clickable` modifier, it's applied on ...
# compose-desktop
a
When using
clickable
modifier, it's applied on mouse up (pointer release) instead of mouse down, which creates a noticeable delay in the UI. (User expectaion is for the action to happen on press, not during recoil) Is that a known issue? I don't find anything about it in the bug tracker.
p
That's the way it works in mobile Android/iOS. A click is expected when finger is up. The first one is on touch. If you want to get the first touch down, use modifier.pointerInput awaiteachGesture awaitFirstDown
r
That's also how it works on desktop for a button for instance. Actions aren't committed on a down event otherwise the user cannot cancel the action
k
In some cases it's useful to fire the action on press down, like continuous scrolling in browsers.
In Aurora I have this as a configuration option
Screenshot_20230406-201559.png
a
@romainguy, on mac os, whether it's on press or release seems to depend on the app. I noticed Google Chrome always uses press to trigger changes (tabs, buttons) and feels snappier than some other apps. But mostly it's pretty inconsistent even within a given app it seems
@romainguy With Google Chrome though, it seems you can press Esc to cancel the action, at least when you click a Tab and stay pressed
r
@adte the native widgets do it on up. Tab selection is different because it's not "destructive". But pressing a button can be.
t
You might notice that on native buttons, if you start a click and then drag off to the side so that the mouse is no longer over the button, the button "pops back up" again. And then if you drag back over it, it depresses again. It's nice because it allows someone to change their mind at the last moment. :-)
(even if that's not what you want here)
r
In Firefox, all buttons (that I've tested) fire on release, including the new tab button, so Chrome seems to be the odd one out here. Also, firing on release makes it integrate easier with different kinds of actions (for example, list items you want to do something when you click, but also want to be able to drag to reorder).