compose-multiplatform
compose-multiplatform copied to clipboard
Keyboard events don't work in web app
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.
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
}
)
fixed in 1.6.10-dev1571