Hi, I have following code snippet: ```import org.j...
# compose-web
t
Hi, I have following code snippet:
Copy code
import org.jetbrains.compose.web.dom.Input

...

Input(attrs = {
        onInput {
         console.log("New value is", it.nativeEvent.target.asDynamic().value as String))
        }
        attr("type", "email")
        attr("autocomplete", "email")
    }, value = value)
It works fine when I'm typing. But when I use autocomplete, then app crashes with ClassCastException at this line:
Do I miss comething or it is bug in JetPack Compose for Web?
a
looks like bug in Compose at first sight. Event system is at very early stages now.
t
Do you have any idea how to work around it?
a
yes, use dom effect and subscribe on event yourself
t
Yay. I'm not sure I know how to do that.
a
Use
DomSideEffect
, you will have element there and you can call
addEventListener
there (it’s raw browser API)
🙏 1
t
o
thanks for reporting. indeed the events need to be improved. another possible workaround might be something like described here -https://github.com/JetBrains/compose-jb/tree/master/tutorials/Web/Events_Handling#other-event-handlers