Anyone already encountered issues with button wher...
# compose-desktop
n
Anyone already encountered issues with button where you have to click like twice for the click to go?
a
That sounds like a very basic thing that would not go unnoticed. Do you have a reproducer?
n
Create a new compose Multiplateform app with desktop enabled from the IntelliJ new project menu, add a button and there it is. We started using Compose Desktop for our debug tools and got the issue on multiple totally independent projects 😅 I’ll make one reproducible I upload and send it (so you have the exact versions and can test too)
👍 1
https://github.com/guimauvedigital/controlresell-ui You can see on this project, it’s our on-going component library. Launching the Storytale desktop app (./gradlew desktopStoriesRun) you can see while clicking on menus that some clicks are having a weird behavior. Seems to happen on Desktop but not on mobile.
Actually I just tested with my coworker, the issue happens only on my MacBook not his… But it never happened on any other app before so I’m not sure what the cause is
a
You have your own button implementation there. Does it reproduce with a material Button?
and as a side note, you don’t need to do
Copy code
var pressed by remember { mutableStateOf(false) }
...
Modifier.pointerInput(enabled, loading) {
    awaitPointerEventScope {
        while (true) {
            val event = awaitPointerEvent()
                pressed = event.changes.any { it.pressed }
            }
        }
    }
}
instead you can do
Copy code
val interactionSource = remember { MutableInteractionSource() }
    val isPressed by interactionSource.collectIsPressedAsState()
    Modifier.clickable(
       interactionSource = interactionSource,
       ...
    )
n
The issue I encounter happens with the buttons from storytale as well
For example in the left menu I sometimes need to click twice to open it
a
Try recording low-level mouse events with pointerInput; see if anything is wrong.
a
Hi Nathan, we do have an ongoing project, and yes, I have experienced this, sometimes you need to click twice to register the clicks. It does happen on Material Buttons as well
n
Do you have any tracking about this issue? (YouTrack ticket or idk)
a
Not that I know of. It’s the first time I hear about it, too.