compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Keyboard events don't work in web app

Open mykola-dev opened this issue 2 years ago • 1 comments

Modifier.onKeyEvent and Modifier.onPreviewKeyEvent do nothing in browser (tried chrome and firefox). Project to reproduce: https://github.com/mykola-dev/Tetris/blob/master/src/commonMain/kotlin/ds/tetris/ui/TetrisGame.kt#L65 arrows keys work fine on android and desktop.

mykola-dev avatar Sep 07 '22 14:09 mykola-dev

I would expect this to stop all key presses from doing anything. In fact I would expect it to stop all keys from doing anything with only the onPreviewKeyEvent however, all key presses still seem to enter text into the TextField ! (On browser platform)

        TextField(
            value = text,
            modifier = Modifier
                .onPreviewKeyEvent { true }
                .onKeyEvent { true },
            onValueChange = {
                text = it
            }
        )

dhakehurst avatar Feb 07 '24 10:02 dhakehurst

fixed in 1.6.10-dev1571

eymar avatar Apr 09 '24 12:04 eymar