We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm working with JetPack Compose for Web and I found that following snippet
@Composable fun ClassCastExceptionTestCaseView() { Input(attrs = { onInput { console.log("New value is", it.nativeEvent.target.asDynamic().value as String) } attr("type", "email") attr("autocomplete", "email") }, value = "") }
causes ClassCastException when using autocomplete. When typing then there is no problem.
ClassCastException
In debugger it looks like this:
I'm not sure but it may be a bug in JetPack Compose for Web.
The text was updated successfully, but these errors were encountered:
According suggestion on Kotlin Slack I implemented this workaround:
@Composable fun ClassCastExceptionTestCaseView() { Input(attrs = { // onInput { // console.log("New value is", it.nativeEvent.target.asDynamic().value as String) // } attr("type", "email") attr("autocomplete", "email") }, value = "") { DomSideEffect { val callback : ((Event)->Unit) = { event -> val newText = event.target.asDynamic().value console.log("New value is", newText) } it.addEventListener("input", callback) onDispose { element -> element.removeEventListener("input", callback) } } } }
Sorry, something went wrong.
This works too
Input(... attrs = { addEventListener("input") { val target = it.nativeEvent.target as HTMLInputElement onChange(target) } } )
fixed in 0.5.0-build228
eymar
No branches or pull requests
Hi, I'm working with JetPack Compose for Web and I found that following snippet
causes
ClassCastException
when using autocomplete. When typing then there is no problem.In debugger it looks like this:
I'm not sure but it may be a bug in JetPack Compose for Web.
The text was updated successfully, but these errors were encountered: