Consider this snippet (playground):
<textarea onInput={event => {
console.log(event.key) // TypeScript error and undefined at runtime
setState(event.currentTarget.value)
}} />
I want to detect whether the user pressed enter or shift-enter.
The browser native event has key
and shiftKey
properties, which are absent on Solid's event. Neither can I find an equivalent to React's event.nativeEvent
property.
Do I really need to use useKeyDownEvent? That approach seems to suffer from a race condition when using it inside the textarea's onInput
though...