Describe the bug
When there is custom local TextInputService then no changes happening while inputting chars by hardware keyboard (only backspace affecting - removing last char before cursor per press).
While the same code for JVM platform works correctly.
Affected platforms
Web (K/JS) - Canvas based API
Versions
Kotlin version*: 1.9.20
Compose Multiplatform version: 1.6.0-dev1276
OS version(s)* (required for Desktop and iOS issues): Linux, Firefox 116.0.2 (64-bit)
OS architecture (x86 or arm64): amd64
To Reproduce
@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun testKeyboard() {
val testTextInputService = remember { TestTextInputService() }
val inputService = remember(testTextInputService) { TextInputService(testTextInputService) }
CompositionLocalProvider(
LocalTextInputService provides inputService,
LocalSoftwareKeyboardController provides testTextInputService
) {
var v by remember { mutableStateOf("initial text") }
TextField(
value = v,
onValueChange = { v = it }
)
}
}
@OptIn(ExperimentalComposeUiApi::class)
@Stable
class TestTextInputService(
) : PlatformTextInputService, SoftwareKeyboardController {
var visible by mutableStateOf(false)
override fun hide() {
visible = false
}
override fun show() {
visible = true
}
@Deprecated(message = "", replaceWith = ReplaceWith("hide()"))
override fun hideSoftwareKeyboard() {
hide()
}
@Deprecated(message = "", replaceWith = ReplaceWith("hide()"))
override fun showSoftwareKeyboard() {
show()
}
override fun startInput(value: TextFieldValue, imeOptions: ImeOptions, onEditCommand: (List<EditCommand>) -> Unit, onImeActionPerformed: (ImeAction) -> Unit) {
}
override fun stopInput() {
}
override fun updateState(oldValue: TextFieldValue?, newValue: TextFieldValue) {
}
}
Expected behavior
Text also changing while inputting it through hardware keyboard
Describe the bug When there is custom local TextInputService then no changes happening while inputting chars by hardware keyboard (only backspace affecting - removing last char before cursor per press). While the same code for JVM platform works correctly.
Affected platforms
Versions
To Reproduce
Expected behavior Text also changing while inputting it through hardware keyboard